Moving Data
* dump 파일 생성하기
[oracle@localhost ~]$ exp
Export: Release 11.2.0.1.0 - Production on Fri Jun 22 14:35:53 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Username: hr
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Enter array fetch buffer size: 4096 >
Export file: expdat.dmp >
(2)U(sers), or (3)T(ables): (2)U > T
Export table data (yes/no): yes > y
Compress extents (yes/no): yes >
Export done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > quit
EXP-00011: HR.QUIT does not exist
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > employees
. . exporting table EMPLOYEES 20 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >
Export terminated successfully with warnings.
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ ls
afiedt.buf Desktop labs q_dbf.sql q_tbs.sql
backup expdat.dmp oradiag_oracle q_log.sql
export/import 실습)
[oracle@localhost ~]$ ls
afiedt.buf Desktop labs q_dbf.sql q_tbs.sql
backup expdat.dmp oradiag_oracle q_log.sql
[oracle@localhost ~]$ cd backup
[oracle@localhost backup]$ ls
arch1 rman uman
[oracle@localhost backup]$ mkdir exp
[oracle@localhost backup]$ cd
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 22 15:18:49 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS> create user expuser identified by expuser;
User created.
SYS> grant connect, resource to expuser;
Grant succeeded.
SYS> conn expuser/expuser
Connected.
EXPUSER> select * from tab;
no rows selected
EXPUSER> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$ exp hr/hr file=/home/oracle/backup/exp/hrtab.dmp tables=employees,departments
Export: Release 11.2.0.1.0 - Production on Fri Jun 22 15:22:33 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table EMPLOYEES 20 rows exported
. . exporting table DEPARTMENTS 8 rows exported
Export terminated successfully without warnings.
[oracle@localhost ~]$
[oracle@localhost ~]$ cd backup/exp/
[oracle@localhost exp]$ ls
hrtab.dmp
[oracle@localhost ~]$ imp system/oracle file=/home/oracle/backup/exp/hrtab.dmp tables=employees,departments fromuser=hr touser=expuser
Import: Release 11.2.0.1.0 - Production on Fri Jun 22 15:26:21 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by HR, not by you
import done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
. importing HR's objects into EXPUSER
. . importing table "EMPLOYEES" 20 rows imported
. . importing table "DEPARTMENTS" 8 rows imported
IMP-00017: following statement failed with ORACLE error 942:
"ALTER TABLE "EMPLOYEES" ADD CONSTRAINT "EMP_JOB_FK" FOREIGN KEY ("JOB_ID") "
"REFERENCES "JOBS" ("JOB_ID") ENABLE NOVALIDATE"
IMP-00003: ORACLE error 942 encountered
ORA-00942: table or view does not exist
IMP-00017: following statement failed with ORACLE error 942:
"ALTER TABLE "DEPARTMENTS" ADD CONSTRAINT "DEPT_LOC_FK" FOREIGN KEY ("LOCATI"
"ON_ID") REFERENCES "LOCATIONS" ("LOCATION_ID") ENABLE NOVALIDATE"
IMP-00003: ORACLE error 942 encountered
ORA-00942: table or view does not exist
About to enable constraints...
IMP-00017: following statement failed with ORACLE error 2430:
"ALTER TABLE "EMPLOYEES" ENABLE CONSTRAINT "EMP_JOB_FK""
IMP-00017: following statement failed with ORACLE error 2430:
"ALTER TABLE "DEPARTMENTS" ENABLE CONSTRAINT "DEPT_LOC_FK""
Import terminated successfully with warnings.
[oracle@localhost ~]$
[oracle@localhost ~]$ sqlplus expuser/expuser
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 22 15:27:35 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXPUSER> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPARTMENTS TABLE
EMPLOYEES TABLE
EXPUSER>
EXPUSER> conn / as sysdba
Connected.
SYS> col object_name for a20
SYS> SELECT object_name, owner FROM dba_objects
2 WHERE object_name IN ('EMPLOYEES','DEPARTMENTS');
OBJECT_NAME OWNER
-------------------- ------------------------------
DEPARTMENTS HR
EMPLOYEES HR
EMPLOYEES EXPUSER
DEPARTMENTS EXPUSER
SYS>
full export/import 실습)
[oracle@localhost ~]$ exp system/oracle file=/home/oracle/backup/exp/fulldb.dmp full=y
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...........
Export terminated successfully with warnings.
[oracle@localhost ~]$ cd backup/exp
[oracle@localhost exp]$ ls -al
total 96852
drwxr-xr-x 2 oracle oinstall 4096 Jun 22 15:34 .
drwxr-xr-x 6 oracle oinstall 4096 Jun 22 15:18 ..
-rw-r--r-- 1 oracle oinstall 99041280 Jun 22 15:35 fulldb.dmp
-rw-r--r-- 1 oracle oinstall 24576 Jun 22 15:22 hrtab.dmp
[oracle@localhost exp]$
[oracle@localhost exp]$ imp system/oracle file=/home/oracle/backup/exp/fulldb.dmp tables=bigemp fromuser=hr touser=expuser
Import: Release 11.2.0.1.0 - Production on Fri Jun 22 15:40:41 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in WE8ISO8859P15 character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
. importing HR's objects into EXPUSER
. . importing table "BIGEMP" 655360 rows imported
Import terminated successfully without warnings.
[oracle@localhost exp]$
[oracle@localhost exp]$ sqlplus expuser/expuser
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 22 15:42:04 2018
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXPUSER> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BIGEMP TABLE
DEPARTMENTS TABLE
EMPLOYEES TABLE
EXPUSER> select count(*) from bigemp;
COUNT(*)
----------
655360
EXPUSER>
'스마트웹&콘텐츠 개발자 과정 > Oracle' 카테고리의 다른 글
Workshop II 남은 부분 수업 (0) | 2018.07.24 |
---|---|
admin 수업 마지막 (0) | 2018.07.03 |
Admin 수업 - 백업 실습 (0) | 2018.06.21 |
admin (0) | 2018.06.20 |
Admin (0) | 2018.06.14 |