- Import:
- Oracle DB setup with default DB
- the username that has access to the import DB
- Remember to set the character set if importing Unicode
- Import/Export:
- ip-address, SID, user/pass (sysDBA)
To export/import a DB using telnet/linux console:
- Set the environment variables (should exist)
1234567
<span style=
"text-decoration: underline;"
>Linux<
/span
>:
$ORACLE_HOME =
/u01/app/oracle/product/10
.2.0
/db_1/bin
$ORACLE_SID = myoracl
$PATH =
/u01/app/oracle/product/10
.2.0
/db_1/bin
<span style=
"text-decoration: underline;"
>Windows<
/span
>:
SET NLS_LANG=AMERICAN_AMERICA.ELI8MSWIN1253
- Startup the DB (if needed)
1
sqlplus
/nolog
SQL prompt:
123connect
user
/pass
as
sysdba
startup
exit
- Startup the listener (if needed)
12
cd
to oracle app product path ($ORACLE_HOME
/bin
)
.
/lsnrctl
start
- Startup the em console (web interface, if needed)
1
.
/emctl
start
- Export data
- entire database:
1
exp dbuser
/password
FULL=y FILE=exportDB.dmp LOG=exportDB.log
- schema only:
1
exp dbuser
/password
FIlE=scott.dmp OWNER=scott
- entire database:
- Importdata
- if needed, create the user for the DB:
123456789
CREATE
USER
username IDENTIFIED
BY
"username"
DEFAULT
TABLESPACE
"USERS"
TEMPORARY
TABLESPACE
"TEMP"
PROFILE
DEFAULT
QUOTA UNLIMITED
ON
"USERS"
;
GRANT
"CONNECT"
TO
username;
GRANT
"DBA"
TO
username;
GRANT
CREATE
session
to
username;
ALTER
USER
username
DEFAULT
ROLE NONE;
- login with new user and try an sql statement:
1
select
sysdate
from
dual;
- entire database:
1
imp dbuser
/password
FULL=y FILE=exportDB.dmp LOG=importDB.log
- schema only:
1
imp dbuser
/password
FIlE=scott.dmp
Notes:
– If you get an error that the export was not done by the user doing the import, you need to do it with the user who actually exported the .dmp file.
– If you get an error trying to import and it stops, you may need to add: dbuser/password@db - if needed, create the user for the DB:
import/export tables only:
- Export tables [emp] and [dept] from “scott” user:
1
exp dbuser
/password
FILE=scott.dmp TABLES=(emp,dept)
- Import tables [dept] and [emp] from “scott” user:
1
imp dbuser
/password
FIlE=importDB.dmp FROMUSER=scott TABLES=(dept,emp)