installazione

  • installare versione [http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_ss_vs_classic SuperServer]

On a single processor machine use the SuperServer version (thread based, more efficient) on a multiprocessor machine use the Classic version (process based) as it can take advantage of multiple processors.

  • set up utenti( ), via ibexpert
  • SYSDBA+masterkey devrebbe essere il login di default
  • C:\WINDOWS\system32\drivers\etc\services

gds_db 3050/tcp # InterBase Server

mend

nel caso un server venga disconnesso o spento accidentalmente è possibile che si verifichino corruzioni dei dati

  • Always make sure you work on a copy of the database, not the production database. Use the operating system to make a copy of the database. You must have exclusive access to the database to do this.

copy employee.gdb database.gdb

  • Now check for database corruption. You must have exclusive access to do this, but since you're working on a copy of the original database, this is not a problem.

gfix -v -full database.gdb

  • mettere il database offline, per impedire successive connessioni. da linea di comando chiede un flag shutdown type, non lo si trova. usare l'interfacia grafica IBExpert

gfix -shut

  • If the previous command has indicated that there are problems with the database, we now need to mend it.

gfix -mend -full -ignore database.gdb

  • backup
  • restore
  • ripristinare il database online

Backup

  • gbak -B -user sysdba -password * /opt/firebird/data/movegiOut.fdb Database/HappyHyppo/Firebird/movegiOut.fbk
  • Operazione di Backup con IBExpert:

- Collegarsi in remoto all'IVG, aprire IBExpert e selezionare il database - Selezionare Service > Database Backup - Ricordare il percorso che compare in FileNale, qui verrà salvato il backup - Premere Start Backup... - Aprire la cartella in cui si trova il file di backup (vigi_Citta.fbk) e 7-zipparlo - Trasferire il file su whyworry e diszipparlo - Ora si è pronti pe l'operazione di Restore...

  • Operazione di Restore con IBExpert:

- Collegarsi in remoto a whyworry - Aprire IBExpert e selezionare il database da aggiornare (se il database non è presente crearlo, un modo può essere quello di selezionare un database già esistente, dx mouse > Clone Registration Info - Aprire il database e selezionare Service > Restore Database - Selezionare il percorso del *.fbk in File Name - Spuntare Replace Existing Database - Premere Start Restore - Inserire Login: copiaincolla e Password...

Resume

  • fare un backup con IBExpert, passarla sul server happyhyppo
  • gbak -R -USER user -PASS * /opt/firebird/data/db.fbk /opt/firebird/data/db.fdb

SQL

Tables and views are stored in RDB$RELATIONS system table. System tables and views have RDB$SYSTEM_FLAG set, while user defined ones have zero or NULL. You can distinguish views from tables as they have field RDB$VIEW_BLR set. Please note that there is also a field RDB$VIEW_SOURCE which stored human-readable view source and can be set to NULL - database would still be completely functional as it uses precompiled BLR. Here's query to list all user tables:

select rdb$relation_name from rdb$relations where rdb$view_blr is null and (rdb$system_flag is null or rdb$system_flag = 0);

A query to list all views:

select rdb$relation_name from rdb$relations where rdb$view_blr is not null and (rdb$system_flag is null or rdb$system_flag = 0);

Table and view columns are stored in RDB$RELATION_FIELDS. It stores the name, null flag, default value, and domain. In order to get the datatype you need to read domain info from rdb$fields. Here's a query that lists all tables with their columns:

select f.rdb$relation_name, f.rdb$field_name from rdb$relation_fields f join rdb$relations r on f.rdb$relation_name = r.rdb$relation_name and r.rdb$view_blr is null and (r.rdb$system_flag is null or r.rdb$system_flag = 0) order by 1, f.rdb$field_position;

Equivalente di LIMIT per Mysql

  SELECT FIRST x [SKIP y] ... [rest OF query]

cast di una string a intero, per ordinamento

  CAST('5,6' AS INTEGER),