Copying a database
If you want to copy the entire database, the basic steps are as follows:
1. Perform a full export:
exp userid=system/manager file=my_db.dmp log=my_db.log full=y
The FULL=Y parameter forces a full database export. I also make sure to log the output of my export utility to a log file. It becomes a handy reference.
2. FTP the dump file (and log file) to the destination server. Make sure that you FTP in binary mode!
3. Precreate a new database on the destination server.
4. Precreate the tablespaces on the new database to match the same tablespace names of your source database.
5. Import the full database:
imp userid=system/manager file=my_db.dmp log=imp.log full=y
Again, log the output to a file in case there are errors.
Copying a schema
If you only want to copy a schema to the new server, things are basically the same.
1. Perform a schema export:
exp userid=system/manager file=my_db.dmp log=my_db.log owner=SCOTT
The OWNER parameter exports a schema. In my example, that would be the SCOTT schema. Again, I also make sure to log the output of my export utility to a log file.
2. FTP the dump file (and log file) to the destination server. Make sure that you FTP in binary mode!
3. Precreate a new database on the destination server.
4. Precreate the tablespaces on the new database to match the same tablespace names of your source database.
5. Precreate the user in that database.
6. Import the dump file:
imp userid=system/manager file=my_db.dmp log=imp.log fromuser=SCOTT
Again, log the output to a file in case there are errors. The FROMUSER clause tells imp which schema to import. If you wish to change the objects to a new owner, use the TOUSER clause as well.
No comments:
Post a Comment