Importing from a Compressed Export Using Named Pipe (FIFO)

Posted at Friday, June 17, 2005
Just had to do this today, so it seemed appropriate to share. When restoring database objects from a compressed dump file on a server without adequate disk space to uncompress it, you can use the method described herein.

In this example, a named pipe (FIFO) is used in order to read the compressed content and then import as appropriate, negating the need to uncompress the dump file. In my example, I create a test user and test table in a sample database. After words, I export the table, compress it, and then run my sample script - imp_without_compressing.sh - in order to import the contents from the compressed export using a named pipe:

$ sqlplus "/ as sysdba"

SQL> create user test identified by test;

User created.

SQL> grant connect, dba to test;

Grant succeeded.

SQL> connect test/test
Connected.
SQL> create table test_export (id number not null);

Table created.

SQL> insert into test_export values (1);

1 row created.

SQL> commit;

Commit complete.

SQL> ! exp userid=test/test file=test_export.dmp tables=\(test_export\);

About to export specified tables via Conventional Path ...
. . exporting table TEST_EXPORT 1 rows
exported
Export terminated successfully without warnings.

SQL> ! gzip test_export.dmp

SQL> ! ls -latr *.gz
-rw-r--r-- 1 oracle oinstall 459 Jun 17 09:22 test_export.dmp.gz

SQL> exit

$ ./imp_without_compressing.sh

Export file created by EXPORT:V09.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing TEST's objects into TEST
. . importing table "TEST_EXPORT" 1 rows
imported
Import terminated successfully without warnings.

$ sqlplus test/test


SQL> select * from test_export;

ID
----------
1
1


Labels: