Pages

Thursday, 24 September 2015

Most recent asked Firebird Interview Questions and Answers

26. how to present flrehird.log file from filling up the disk partition? 
Here are some tips:
a) create a scheduled task or cron job that will truncate or rotate the log file. By rotation, we mean renaming the flies in such way that you always have a number of previous logs available. Example.
delete flrebird.log.5
rename firebird. iog.4 firebird. log. 5
rename flrebird.iog.3 firebird.log.4
rename flrebird.log.2 firebird.log.3
rename firebird.log.l f’irebird.iog,2
rename firebird.iog firebird.log. I
This way you’ll always have last five logs available, and those too old get deleted. You
can also use zip, rar, bzip2 or some other packer to compress the old log files. Since they are plain text, they compress very well.

b) redirect logging to void. For example, on Linux, you can do it by creating a symlink to /dev/null instead of the regular log file:
# cd /opt/firebird
# rm -f firebird log
in -s /dev/null firebird.log

27. How to pump the data from one database to another? 
Many recommend IB Pump or IB Data Pump, but the problem is when you have complex relations between tables. In such cases, it is better to use tool like FB Copy which sorts the tables by dependencies (foreign keys, check constraints) into correct order

28. How to recreate the index on a Firebird table? 
Recreating the index:
ALTER INDEX indexName INACTIVE.
ALTER INDEX indexName ACT1VE
Please note that it does not work for indices automatically created by the system like the ones for primary key or foreign key. You might want to drop and recreate the constraints in such case.
To recalculate the index statistics (which is enough for most cases), use:
SET STATISTICS INDEX indexName;

29. how to reorder the table columns (fields)? 
While the order should not matter to applications (you should always use explicit column names in queries), perhaps it’s easier for you when you work with tables in database administration tools. You can move a column to different location using the following SQL statement:
ALTER TABLE table_name ALTER field name POSITION new_position:
Positions are numbered from one. If you wish to exchange two fields, make sure you run the statement for both of them. It’s easy to run tools like FlameRobin to do this (Reorder Fields option at table’s properties screen).

30. how to repair a corrupt Firebird database? 
Here’s a short step-by-step walkthrough.
* disconnect users and disable incoming connections to the database
* make a copy of database file (or two copies) and work on that
* use GFIX with -v option to validate the database file
* use GF1X with -v and -f to do full validation
If problem is not too serious, you can try to backup the broken db and restore under a new name:
* use GF1X -mend to prepare corrupt database for backup
* use GBAK -b -g to backup the database. -g disables garbage collection (FAQ #41)
* use GBAK -c to restore backup to a new database.
If you succeed, you have fixed the problem and have a functional database. If not, you can try to create an empty database with the same structure and pump the data to it.
One of the reasons why backup or restore can fail is if some broken database triggers exist, and prevent connection to the database. For example, a database trigger might use some table which has a broken index, etc. To work around this, connect to database with isql tool using -nodbtriggers option and then disable those triggers. You can enable them later when you fix other problems and get a working database again.

More Questions & Answers:-

No comments:

Post a Comment