Oracle Database Import and Export

Export database:

     The first step: first use plsql connect to the database, click on the file-> new-> sql window, create a new window.

                   Perform the following sentence sql

                   select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0;

                  Sql sentence execution order to the library, empty table can also be exported.

     Step: WIN + R key is pressed, the input cmd, dos into the window.

                   In dos window execute the following command sentence can export library

                   exp sys/[email protected]:1521/orcl file=D:\test.dmp

                  Description:

                        sys: is the database user name

                        oracle: the database user password

                       127.0.0.1:1521/orcl: is the address of the remote database

                        D: \ test.dmp: Export database is to be saved addresses

 Import database:

           The first step: first use plsql connect to the database, click on the file-> new-> sql window, create a new window.

           Step 2: Create a table space using the following sql sentence

                         create tablespace TEST_BIZ datafile 'E:\\TEST_BIZ.dbf' size 50M autoextend on next 10M maxsize unlimited; 

                 Description:

                     TEST_BIZ: is the name of the table space to be created

                     E: \\ TEST_BIZ.dbf: table space is put there

          The third step: Use the following phrase sql create user

                      create user TEST_USER identified by TEST_PASSWORD default tablespace TEST_BIZ;

                    Description:

                        TEST_USER: Username created

                        TEST_PASSWORD: user password created

                        TEST_BIZ: The user table space

        Step four: Use the following sql to authorized users

                        grant dba to TEST_USER;

       Step five: WIN + R key is pressed, the input cmd, dos into the window.

                    Execute the following command in the dos window

                     imp TEST_USER/[email protected]:1521/orcl file=D:\test.dmp full=y ignore=y

                   Description:

                     TEST_USER: Username

                     TEST_PASSWORD: Password

                     127.0.0.1:1521/orcl: remote host address

                      D: \ test.dmp: Location dmp file

Guess you like

Origin www.cnblogs.com/hbuser/p/10948842.html
Recommended