简体   繁体   中英

How do I export an entire database from Oracle 10 and import it to Oracle 11.2.0 with all users?

I have got Oracle 10 on A computer and there I have got a database centt. On B computer I have got installed Oracle 11.2.0 and there is no database. The name of the database on A computer is centt and there I have also some users like stt, wnn, tnn, etc. Now I would like to export entire database from A computer with all users to file (eg allDBdump.dat). Then I would like to import this database (file allDBdump.dat) to B computer. I have used export command like below on A computer:

exp userid=sys/sys file='c:\allDBdump.dat' log='c:\allDBdump.log' FULL=Y

Now I would like to import entire database on A computer with all users. I know that before import I need to create a database on A computer, by "Database Configuration Assistant". Then I need to create all users in sql tool by commands:

CREATE USER st IDENTIFIED BY st;
GRANT ALL PRIVILEGES TO st WITH ADMIN OPTION;
GRANT IMP_FULL_DATABASE TO st WITH ADMIN OPTION;

Then I use command to import database:

imp 'sys/sys@192.168.61.62:1521/centt as sysdba' FULL=Y file=allDBdump.dat fromuser=st touser=st

This solution is good, but I need to know all users before import. The question is how to do it, how to import allDBdump.dat without creating all users on A computer. Something like:

imp 'sys/sys@192.168.61.62:1521/centt as sysdba' FULL=Y file=allDBdump.dat IMPORT_ENTIRE_DATABASE_WITH_ALL_USERS_ON_A_COMPUTER

Thank you very much.

Have you tried Datapump ?. It's much better. Only drawback it's that you'll need a directory on both the servers (or link them with db_link)

expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log

impdp system/password@db11g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=impdpDB11G.log

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM