Subject | Re: [firebird-support] data dumping |
---|---|
Author | Helen Borrie |
Post date | 2005-02-17T15:58:09Z |
At 03:36 PM 17/02/2005 +0200, you wrote:
FbExport works for me.
about that the server has a footprint of less than 1.5 Mb...
You can use the built-in capabilities to export text if you want, using
external files. Here's a simple example. Create this script in a text
editor and save it (remembering to terminate the script with a carriage
return).
/* script EMPLOYEE_DUMP.SQL */
create table employee_txt external 'l:\data\employee_dump.CSV'
(
EMP_NO CHAR(6), FIRST_NAME CHAR(16),
LAST_NAME CHAR(21), PHONE_EXT CHAR(5),
HIRE_DATE CHAR(25), DEPT_NO CHAR(4),
JOB_CODE CHAR(6), JOB_GRADE CHAR(6),
JOB_COUNTRY CHAR(16), SALARY CHAR(12),
FULLNAME CHAR(37), EOL SMALLINT DEFAULT 2573);
COMMIT;
INSERT INTO EMPLOYEE_TXT
SELECT
CAST(EMP_NO AS CHAR(5))||',',
FIRST_NAME ||',',
LAST_NAME ||',',
COALESCE(PHONE_EXT,'--') ||',',
CAST(HIRE_DATE AS CHAR(24))||',',
DEPT_NO ||',',
JOB_CODE ||',', JOB_GRADE ||',',
JOB_COUNTRY ||',',
CAST(SALARY AS CHAR(11))||',',
FULL_NAME, 2573
FROM EMPLOYEE ORDER BY FULL_NAME;
COMMIT;
Start isql, connecting to the employee.fdb database:
isql c:\program files\firebird\firebird_1_5\examples\employee.fdb -u sysdba
-pas blaaah
SQL>input c:\somepath\employee_dump.sql;
SQL>quit;
Now, open the external file in Excel or a text editor.
www.ibobjects.com).
You don't "restore" from a text file, you restore from a gbak backup.
You might like to look at DBak (www.telesiscomputing.com.au). It's a kind
of dump-and-reconstruct utility.
./hb
>Hi,FbCopy is for pumping, not dumping.
>I did some reading but didn't find a way how to dump only data from a
>firebird database. With isql I could dump only a database structure(DDL)
>with no data(MLD). I found some tools like fbcopy and fbexport but their
>execution terminates immediatly with no errors and with no results :(
FbExport works for me.
>It's somehow lame that server comes without tools for data dumping...Tools for doing most external things are third-party. That's how it comes
about that the server has a footprint of less than 1.5 Mb...
You can use the built-in capabilities to export text if you want, using
external files. Here's a simple example. Create this script in a text
editor and save it (remembering to terminate the script with a carriage
return).
/* script EMPLOYEE_DUMP.SQL */
create table employee_txt external 'l:\data\employee_dump.CSV'
(
EMP_NO CHAR(6), FIRST_NAME CHAR(16),
LAST_NAME CHAR(21), PHONE_EXT CHAR(5),
HIRE_DATE CHAR(25), DEPT_NO CHAR(4),
JOB_CODE CHAR(6), JOB_GRADE CHAR(6),
JOB_COUNTRY CHAR(16), SALARY CHAR(12),
FULLNAME CHAR(37), EOL SMALLINT DEFAULT 2573);
COMMIT;
INSERT INTO EMPLOYEE_TXT
SELECT
CAST(EMP_NO AS CHAR(5))||',',
FIRST_NAME ||',',
LAST_NAME ||',',
COALESCE(PHONE_EXT,'--') ||',',
CAST(HIRE_DATE AS CHAR(24))||',',
DEPT_NO ||',',
JOB_CODE ||',', JOB_GRADE ||',',
JOB_COUNTRY ||',',
CAST(SALARY AS CHAR(11))||',',
FULL_NAME, 2573
FROM EMPLOYEE ORDER BY FULL_NAME;
COMMIT;
Start isql, connecting to the employee.fdb database:
isql c:\program files\firebird\firebird_1_5\examples\employee.fdb -u sysdba
-pas blaaah
SQL>input c:\somepath\employee_dump.sql;
SQL>quit;
Now, open the external file in Excel or a text editor.
>What other tools can you suggest for dumpng/restoring database exceptFor dumping - I normally use the Export tool in IB_SQL (free from
>fbcopy and fbexport?
www.ibobjects.com).
You don't "restore" from a text file, you restore from a gbak backup.
You might like to look at DBak (www.telesiscomputing.com.au). It's a kind
of dump-and-reconstruct utility.
>Btw, maybe somebody have experienced such strage behavior of the fbcopy too?Did you try to use it for pumping data table to table?
./hb