成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

Oracle12cpdb使用expdp/impdp導(dǎo)入導(dǎo)出

12c推出了可插拔數(shù)據(jù)庫,在一個容器cdb中以多租戶的形式同時存在多個數(shù)據(jù)庫pdb。在為pdb做數(shù)據(jù)泵導(dǎo)入導(dǎo)出時和傳統(tǒng)的數(shù)據(jù)庫有少許不同。

網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及定制網(wǎng)站建設(shè)服務(wù),專注于成都定制網(wǎng)頁設(shè)計,高端網(wǎng)頁制作,對茶藝設(shè)計等多個行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗的網(wǎng)站建設(shè)公司。專業(yè)網(wǎng)站設(shè)計,網(wǎng)站優(yōu)化推廣哪家好,專業(yè)seo優(yōu)化排名優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。

          1,需要為pdb添加tansnames

          2,導(dǎo)入導(dǎo)出時需要在userid參數(shù)內(nèi)指定其tansnames的值,比如 userid=user/pwd@tnsname

 

數(shù)據(jù)泵導(dǎo)出

1、查看當(dāng)前的SID,查看pdb并切換到容器數(shù)據(jù)庫,這里的pluggable數(shù)據(jù)庫是pdborcl
[oracle@test admin]$ echo $ORACLE_SID
[oracle@test admin]orcl

登錄cdb,查看pdb,

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
PDB$SEED                      READ ONLY    NO
PDBORCL                       MOUNTED

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
PDB$SEED                      READ ONLY  NO
PDBORCL                       READ WRITE NO

切換到pdborcl

SQL> alter session set container=pdborcl;

Session altered.

SQL>

2、查看示例用戶scott,以后的schema級別導(dǎo)入導(dǎo)出就使用該用戶的數(shù)據(jù)。
SQL> select owner, table_name from dba_tables where owner='SCOTT';

OWNER                   TABLE_NAME
------------------------------ ----------------------------------------
SCOTT                   SALGRADE
SCOTT                   BONUS
SCOTT                   EMP
SCOTT                   DEPT


3、單獨創(chuàng)建一個dba權(quán)限的數(shù)據(jù)泵用戶
SQL> grant dba to dp identified by dp;
Grant succeeded.

4、創(chuàng)建一個數(shù)據(jù)泵目錄dp_dir,路徑為oracle家目錄
SQL> create or replace directory dp_dir as  '/home/oracle';

Directory created.

SQL> exit

5、授予dp用戶在數(shù)據(jù)泵路徑有讀寫權(quán)限

(如果是dba權(quán)限的這一步可以省略,為了試驗的完整性這里保留)

SQL> grant read,write on directory dp_dir to dp;
Grant succeeded.

6、設(shè)置tnsnames.ora,增加pdborocl。SERVICE_NAME為pdb的實例名,這里為pdborcl
[oracle@xqzt admin]$ pwd
/data/app/oracle/product/12.1.0/dbhome_1/network/admin
[oracle@xqzt admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /data/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xqzt)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )


PDBORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xqzt)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =pdborcl)
    )
  )

7、測試tnsnames.ora的有效性,如果返回OK (0 msec)表示配置成功
[oracle@xqzt admin]$ tnsping pdborcl

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 10-DEC-2015 09:10:34

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:
/data/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xqzt)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =pdborcl)))
OK (0 msec)

8、數(shù)據(jù)泵導(dǎo)出
    • 用戶名密碼為dp/dp,并且通過tnsnames指向pdborcl

    • 數(shù)據(jù)泵目錄為:dp_dir, OS路徑是/home/oracle

    • 導(dǎo)出文件為:/home/oracle/scott_pdborcl.dmp

    • 導(dǎo)出日志為:/home/oracle/scott_pdborcl.log

    • 導(dǎo)出模式為scheme,也可以理解為用戶:scott

[oracle@xqzt ~]$ expdp dp/dp@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl.log schemas=scott

Export: Release 12.1.0.2.0 - Production on Thu Dec 10 09:32:05 2015Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "DP"."SYS_EXPORT_SCHEMA_01":  dp/********@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl.log schemas=scott 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "SCOTT"."DEPT"                              6.023 KB       4 rows
. . exported "SCOTT"."EMP"                               8.773 KB      14 rows
. . exported "SCOTT"."SALGRADE"                          6.023 KB      10 rows
. . exported "SCOTT"."BONUS"                                 0 KB       0 rows
Master table "DP"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for DP.SYS_EXPORT_SCHEMA_01 is:
  /home/oracle/scott_pdborcl.dmp
Job "DP"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Dec 10 09:32:29 2015 elapsed 0 00:00:21

[oracle@xqzt ~]$

10、查看導(dǎo)出文件
[oracle@xqzt ~]$ ls  -l scott_pdborcl.dmp  scott_pdborcl.log
-rw-r----- 1 oracle oinstall 356352 12月 10 09:32 scott_pdborcl.dmp
-rw-r--r-- 1 oracle oinstall   1960 12月 10 09:32 scott_pdborcl.log

11、為了測試導(dǎo)出文件是否能夠正常導(dǎo)入,我們先刪除pdborcl的scott用戶
SQL> select count(*) from scott.DEPT;

  COUNT(*)
----------

SQL> drop user scott cascade  ;

User dropped.

SQL>

此時訪問該用戶的表已經(jīng)不存在了

SQL> select count(*) from scott.DEPT;
select count(*) from scott.DEPT                           
*ERROR at line 1:

ORA-00942: table or view does not exist
12、 導(dǎo)入scott用戶
[oracle@xqzt ~]$ impdp dp/dp@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl_imp.log schemas=scott

Import: Release 12.1.0.2.0 - Production on Thu Dec 10 09:39:02 2015Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Master table "DP"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting "DP"."SYS_IMPORT_SCHEMA_01":  dp/********@pdborcl directory=dp_dir dumpfile=scott_pdborcl.dmp logfile=scott_pdborcl_imp.log schemas=scott 
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."DEPT"                              6.023 KB       4 rows
. . imported "SCOTT"."EMP"                               8.773 KB      14 rows
. . imported "SCOTT"."SALGRADE"                          6.023 KB      10 rows
. . imported "SCOTT"."BONUS"                                 0 KB       0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Job "DP"."SYS_IMPORT_SCHEMA_01" successfully completed at Thu Dec 10 09:39:06 2015 elapsed 0 00:00:04

[oracle@xqzt ~]$

13、 測試導(dǎo)入結(jié)果

SQL> select count(*) from scott.DEPT;  
COUNT(*)
----------
     4

導(dǎo)入成功!

網(wǎng)站欄目:Oracle12cpdb使用expdp/impdp導(dǎo)入導(dǎo)出
分享地址:http://jinyejixie.com/article38/iihipp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、ChatGPT微信小程序、網(wǎng)站維護網(wǎng)站設(shè)計、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
淮滨县| 墨江| 绩溪县| 乐清市| 杭锦后旗| 荔浦县| 体育| 西乌珠穆沁旗| 韩城市| 张掖市| 西平县| 沅江市| 甘洛县| 武陟县| 延长县| 绥阳县| 黄骅市| 北流市| 讷河市| 蒲城县| 胶州市| 正宁县| 嘉兴市| 石棉县| 出国| 泉州市| 丰顺县| 右玉县| 霍邱县| 正安县| 公安县| 肇庆市| 仙游县| 昌邑市| 农安县| 怀仁县| 元朗区| 台江县| 柞水县| 井研县| 南汇区|