Oracle 常用工具和问题分析
1.Oracle 原生態(tài)的一些工具
在$ORACLE_HOME/bin下面有很多的命令工具。常用的有orabase,oerr,sqlplus,rman,exp/expdp,imp/impdp,sqlldr等。
主要討論一下sqlplus, exp/expdp, imp/impdp
- orabase
此命令是$ORACLE_BASE的簡(jiǎn)化版本。
- oerr
此工具很有用,本身是個(gè)shell腳本,使用起來(lái)非常方便
[oracle@MaxwellDBA bin]$ oerr ora 00001 00001, 00000, "unique constraint (%s.%s) violated" // *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key. // For Trusted Oracle configured in DBMS MAC mode, you may see // this message if a duplicate entry exists at a different level. // *Action: Either remove the unique restriction or do not insert the key. [oracle@MaxwellDBA bin]查看數(shù)據(jù)庫(kù)的錯(cuò)誤信息,可以看到其實(shí)屬于rdbms的范疇。
[oracle@MaxwellDBA bin]$ grep -i "^ora:" $ORACLE_HOME/lib/facility.lis ora:rdbms:*: [oracle@MaxwellDBA bin]$調(diào)用的方式是采用awk來(lái)讀取錯(cuò)誤信息片段,假設(shè)錯(cuò)誤代碼是64621.可以通過(guò)以下獲取錯(cuò)誤說(shuō)明。
Code=64621awk "BEGIN { found = 0; }/^[0]*$Code/ { found = 1; print ; next; }/^\/\// { if (found) { print; } next; }{ if (found) { exit; } }" $ORACLE_HOME/rdbms/mesg/oraus.msg [oracle@MaxwellDBA bin]$ Code=64621 [oracle@MaxwellDBA bin]$ awk "BEGIN { found = 0; } > /^[0]*$Code/ { found = 1; print ; next; } > /^\/\// { if (found) { print; } next; }{ if (found) { exit; } }" $ORACLE_HOME/rdbms/mesg/oraus.msg 64621, 00000, "SQL statement length (%s) exceeds maximum allowed length (%s)" // *Cause: An attempt was made to issue a SQL statement that exceeded the // maximum allowed length of a statement. // *Action: Modify the SQL statement or the views to which it refers to fit // within the maximum length or split the SQL statement. // [oracle@MaxwellDBA bin]$SQL*PLUS使用及常見(jiàn)問(wèn)題
SQL*PLUS是ORACLE提供訪問(wèn)數(shù)據(jù)庫(kù)服務(wù)器的客戶端軟件,是ORACLE的核心組件,也是ORACLE DBA的常用工具。
設(shè)置SQL*PLUS的登錄配置。
$ORACLE_HOME/sqlplus/admin/admin/glogin.sql
-- File Name : /dba/19c/glogin.sql -- Author : Maxwell -- Description : Resets the SQL*Plus prompt when a new connection is made. -- Includes PDB:CDB. -- Call Syntax : @login -- Last Modified: 28/09/2022 -- ----------------------------------------------------------------------------------- SET FEEDBACK OFF SET TERMOUT OFFCOLUMN X NEW_VALUE Y SELECT LOWER(USER || '@' ||SYS_CONTEXT('userenv', 'con_name') || ':' ||SYS_CONTEXT('userenv', 'instance_name')) X FROM dual; SET SQLPROMPT '&Y> 'ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'; ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI:SS.FF';SET TERMOUT ON SET FEEDBACK ON SET LINESIZE 300 SET TAB OFF SET TRIM ON SET TRIMSPOOL ON SET LONG 5000 SET PAGESIZE 9999 COLUMN PLAN_PLUS_EXP FORMAT A80 COLUMN GLOBAL_NAME NEW_VALUE GNAME SET SERVEROUTPUT ON SIZE 1000000 ~ [oracle@MaxwellDBA admin]$ sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Thu Oct 6 10:24:16 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0sys@cdb$root:orclcdb>使用show SGA可以查看相關(guān)信息。
sys@cdb$root:orclcdb> show SGATotal System Global Area 1509946304 bytes Fixed Size 9135040 bytes Variable Size 1090519040 bytes Database Buffers 402653184 bytes Redo Buffers 7639040 bytes sys@cdb$root:orclcdb>?
[oracle@MaxwellDBA admin]$ tnsping ORCLPDB1TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 06-OCT-2022 10:37:32Copyright (c) 1997, 2019, Oracle. All rights reserved.Used parameter files: /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.oraUsed TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLPDB1))) OK (0 msec) [oracle@MaxwellDBA admin]$ tnsping ORCLCDBTNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 06-OCT-2022 10:37:49Copyright (c) 1997, 2019, Oracle. All rights reserved.Used parameter files: /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.oraUsed TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = MaxwellDBA)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLCDB))) OK (0 msec) [oracle@MaxwellDBA admin]$ [oracle@MaxwellDBA admin]$ ping MaxwellDBA PING MaxwellDBA (172.XXXX.XXX.177) 56(84) bytes of data. 64 bytes from MaxwellDBA (172.XXXX.XXX.177): icmp_seq=1 ttl=64 time=0.051 ms 64 bytes from MaxwellDBA (172.XXXX.XXX.177): icmp_seq=2 ttl=64 time=0.030 ms ^C --- MaxwellDBA ping statistics --- 7 packets transmitted, 7 received, 0% packet loss, time 6173ms rtt min/avg/max/mdev = 0.029/0.035/0.051/0.009 ms [oracle@MaxwellDBA admin]$2 解析exp/imp 及常見(jiàn)問(wèn)題
作為DBA,經(jīng)常需要在不同的數(shù)據(jù)庫(kù)環(huán)境之間做數(shù)據(jù)的導(dǎo)入導(dǎo)出,exp/imp是便捷的客戶端工具。可以很方便地在不同數(shù)據(jù)庫(kù)之間轉(zhuǎn)移數(shù)據(jù)對(duì)象。
expdp/impdp是基于服務(wù)端的數(shù)據(jù)導(dǎo)入導(dǎo)出工具。
exp/imp使用場(chǎng)景及示例
使用exp/imp主要有4種模式: 數(shù)據(jù)庫(kù)模式、表模式、用戶模式、可傳輸表空間模式。
(1)數(shù)據(jù)庫(kù)模式
數(shù)據(jù)庫(kù)模式主要是作為全庫(kù)備份使用的。可以導(dǎo)出除SYS之外數(shù)據(jù)庫(kù)里的所有對(duì)象,在數(shù)據(jù)量較小的情況下是一個(gè)不錯(cuò)的選擇。
[oracle@MaxwellDBA dmpfilesummary]$ exp system/system@ORCLCDB file=db_backup.dmp full=y Export: Release 19.0.0.0.0 - Production on Thu Oct 6 11:54:46 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 Export done in AL32UTF8 character set and AL16UTF16 NCHAR character setAbout to export the entire database ... . exporting tablespace definitions . exporting profiles . exporting user definitions . exporting roles . exporting resource costs . exporting rollback segment definitions . exporting database links . exporting sequence numbers . exporting directory aliases . exporting context namespaces . exporting foreign function library names . exporting PUBLIC type synonyms . exporting private type synonyms . exporting object type definitions . exporting system procedural objects and actions . exporting pre-schema procedural objects and actions . exporting cluster definitions . about to export AUDSYS's tables via Conventional Path ... . about to export SYSTEM's tables via Conventional Path ... . . exporting table AQ$_KEY_SHARD_MAP 0 rows exported . . exporting table BOOKS 1 rows exported . . exporting table BOOK_COPIES 1 rows exported . . exporting table COUNTRIES 25 rows exported . . exporting table DEPARTMENTS 27 rows exported . . exporting table DEPT 4 rows exported . . exporting table EMP 14 rows exported . . exporting table EMPLOYEES 107 rows exported . . exporting table JOBS 19 rows exported . . exporting table JOB_HISTORY 10 rows exported . . exporting table LOCATIONS 23 rows exported . . exporting table OL$ . . exporting table OL$HINTS . . exporting table OL$NODES . . exporting table PEOPLE 2 rows exported . . exporting table REGIONS 4 rows exported . . exporting table SQLPLUS_PRODUCT_PROFILE 0 rows exported . . exporting table SQL_TEST 3 rows exported . about to export OUTLN's tables via Conventional Path ... . . exporting table OL$ 0 rows exported . . exporting table OL$HINTS 0 rows exported . . exporting table OL$NODES 0 rows exported . about to export GSMROOTUSER's tables via Conventional Path ... . about to export REMOTE_SCHEDULER_AGENT's tables via Conventional Path ... . about to export DBSFWUSER's tables via Conventional Path ... . . exporting table ACL$_OBJ 0 rows exported . . exporting table EXADIRECT_ACL 0 rows exported . . exporting table IP_ACL 0 rows exported . about to export SYS$UMF's tables via Conventional Path ... . about to export MDDATA's tables via Conventional Path ... . exporting synonyms . exporting views . exporting referential integrity constraints . exporting stored procedures . exporting operators . exporting indextypes . exporting bitmap, functional and extensible indexes . exporting posttables actions . exporting triggers . exporting materialized views . exporting snapshot logs . exporting job queues . exporting refresh groups and children . exporting dimensions . exporting post-schema procedural objects and actions EXP-00061: unable to find the outer table name of a nested table EXP-00000: Export terminated unsuccessfully [oracle@MaxwellDBA dmpfilesummary]$ ls -ltr total 1616 -rw-r--r-- 1 oracle oinstall 1654784 Oct 6 12:17 db_backup.dmp [oracle@MaxwellDBA dmpfilesummary]$(2)表模式
表模式可以導(dǎo)出某個(gè)用戶下指定的表
[oracle@MaxwellDBA dmpfilesummary]$ exp SCOTT/TIGER@ORCLPDB1 file=emp.dmp tables=empExport: Release 19.0.0.0.0 - Production on Thu Oct 6 12:46:36 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 Export done in AL32UTF8 character set and AL16UTF16 NCHAR character setAbout to export specified tables via Conventional Path ... . . exporting table EMP 14 rows exported Export terminated successfully without warnings. [oracle@MaxwellDBA dmpfilesummary]$(3)用戶模式
用戶模式可以導(dǎo)出指定用戶下所有的對(duì)象。
[oracle@MaxwellDBA dmpfilesummary]$ exp SCOTT/TIGER@ORCLPDB1 file=SCOTT_mode.dmp owner=SCOTTExport: Release 19.0.0.0.0 - Production on Thu Oct 6 12:49:09 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set . exporting pre-schema procedural objects and actions . exporting foreign function library names for user SCOTT . exporting PUBLIC type synonyms . exporting private type synonyms . exporting object type definitions for user SCOTT About to export SCOTT's objects ... . exporting database links . exporting sequence numbers . exporting cluster definitions . about to export SCOTT's tables via Conventional Path ... . . exporting table BIG_TABLE 54915 rows exported . . exporting table BONUS 0 rows exported . . exporting table CHILD 0 rows exported . . exporting table DEPT 4 rows exported . . exporting table EMP 14 rows exported . . exporting table PARENT 0 rows exported . . exporting table RUN_STATS . . exporting table SALGRADE 5 rows exported . . exporting table SYS_TEMP_FBT . . exporting table T 0 rows exported . . exporting table T1 0 rows exported . . exporting table T2 0 rows exported . . exporting table TEST01 0 rows exported . exporting synonyms . exporting views . exporting stored procedures . exporting operators . exporting referential integrity constraints . exporting triggers . exporting indextypes . exporting bitmap, functional and extensible indexes . exporting posttables actions . exporting materialized views . exporting snapshot logs . exporting job queues . exporting refresh groups and children . exporting dimensions . exporting post-schema procedural objects and actions . exporting statistics Export terminated successfully without warnings. [oracle@MaxwellDBA dmpfilesummary]$(4)可傳輸表空間模式
可傳輸表空間模式常作為數(shù)據(jù)遷移時(shí)的一種方法。
診斷案例:外部表的導(dǎo)入導(dǎo)出問(wèn)題
首先是使用exp導(dǎo)出一個(gè)很小的外部表花費(fèi)了很長(zhǎng)的時(shí)間。
[oracle@MaxwellDBA dmpfilesummary]$ exp hr/hr@ORCLPDB1 file=hr.dmp log=hr.log Export: Release 19.0.0.0.0 - Production on Thu Oct 6 13:11:27 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set . exporting pre-schema procedural objects and actions . exporting foreign function library names for user HR . exporting PUBLIC type synonyms . exporting private type synonyms . exporting object type definitions for user HR About to export HR's objects ... . exporting database links . exporting sequence numbers . exporting cluster definitions . about to export HR's tables via Conventional Path ... . . exporting table COUNTRIES 25 rows exported . . exporting table DEPARTMENTS 27 rows exported . . exporting table DEPT60_BONUSES 3 rows exported . . exporting table EMPLOYEES 107 rows exported . . exporting table EMPLOYEES1 107 rows exported . . exporting table EMPLOYEES2 107 rows exported . . exporting table JOBS 20 rows exported . . exporting table JOB_HISTORY 10 rows exported . . exporting table LOCATIONS 23 rows exported . . exporting table REGIONS 4 rows exported . . exporting table REGIONS2 4 rows exported . exporting synonyms . exporting views . exporting stored procedures . exporting operators . exporting referential integrity constraints . exporting triggers . exporting indextypes . exporting bitmap, functional and extensible indexes . exporting posttables actions . exporting materialized views . exporting snapshot logs . exporting job queues . exporting refresh groups and children . exporting dimensions . exporting post-schema procedural objects and actions . exporting statistics Export terminated successfully without warnings. [oracle@MaxwellDBA dmpfilesummary]$外部表是在10g之后的新特性,外部表定義中會(huì)涉及相關(guān)的directory,它是基于服務(wù)端的,所以采用數(shù)據(jù)泵才是正解。下面來(lái)看以下使用expdp的情況。
[oracle@MaxwellDBA dmpfilesummary]$ expdp hr/hr@ORCLPDB1 dumpfile=hr_dp.dmp DIRECTORY=alert_dir tables=alert_logExport: Release 19.0.0.0.0 - Production on Thu Oct 6 13:19:52 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production ORA-39002: invalid operation ORA-39070: Unable to open the log file. ORA-39087: directory name ALERT_DIR is invalid[oracle@MaxwellDBA dmpfilesummary]$?
sys@cdb$root:orclcdb> create directory alert_dir as '/home/oracle/expdp_alert';Directory created.sys@cdb$root:orclcdb> grant read,write on directory alert_dir to hr;Grant succeeded.sys@cdb$root:orclcdb> [oracle@MaxwellDBA ~]$ expdp hr/hr@ORCLPDB1 dumpfile=hr_dp.dmp DIRECTORY=alert_dir tables=employeesExport: Release 19.0.0.0.0 - Production on Thu Oct 6 13:55:18 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Starting "HR"."SYS_EXPORT_TABLE_01": hr/********@ORCLPDB1 dumpfile=hr_dp.dmp DIRECTORY=alert_dir tables=employees Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type TABLE_EXPORT/TABLE/COMMENT Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type TABLE_EXPORT/TABLE/TRIGGER . . exported "HR"."EMPLOYEES" 17.08 KB 107 rows Master table "HR"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for HR.SYS_EXPORT_TABLE_01 is:/home/oracle/expdp_alert/hr_dp.dmp Job "HR"."SYS_EXPORT_TABLE_01" successfully completed at Thu Oct 6 13:55:44 2022 elapsed 0 00:00:25[oracle@MaxwellDBA ~]$如何查看dump文件的一些基本信息
[oracle@MaxwellDBA dmpfilesummary]$ strings hr.dmp | head -10 iEXPORT:V19.00.00 RUSERS 8192Thu Oct 6 13:11:28 2022hr.dmp #G#G #G#G +00:00 BYTE UNUSED INTERPRETED [oracle@MaxwellDBA dmpfilesummary]$如何得到dump中表的信息
對(duì)于dump文件,我們可以解析出含有的表名,使用strings、awk、sed結(jié)合可以很方便地完成這個(gè)功能。
[oracle@MaxwellDBA dmpfilesummary]$ strings hr.dmp | grep "CREATE TABLE " | awk '{print $3}'|sed 's/"//g' COUNTRIES DEPARTMENTS DEPT60_BONUSES EMPLOYEES EMPLOYEES1 EMPLOYEES2 JOBS JOB_HISTORY LOCATIONS REGIONS REGIONS2 [oracle@MaxwellDBA dmpfilesummary]$如何解析dump文件生成parfile
如果需要根據(jù)dump生成對(duì)應(yīng)的parfile來(lái)做數(shù)據(jù)導(dǎo)入導(dǎo)出,可以使用如下的命令來(lái)解析dump 生成parfile.
[oracle@MaxwellDBA dmpfilesummary]$ strings hr.dmp | grep "CREATE TABLE " | awk '{print $3}'|sed 's/"//g'|awk '{if(FNR==1) print "tables="$1 ; else print ","$1}' tables=COUNTRIES ,DEPARTMENTS ,DEPT60_BONUSES ,EMPLOYEES ,EMPLOYEES1 ,EMPLOYEES2 ,JOBS ,JOB_HISTORY ,LOCATIONS ,REGIONS ,REGIONS2 [oracle@MaxwellDBA dmpfilesummary]$?導(dǎo)入dump時(shí)需要注意的隱患
在導(dǎo)入dump文件時(shí)還是有很多的前提工作需要做。
(1)查看dump文件時(shí)還是有很多的前提工作需要做的。
(2)得到dump中的表信息對(duì)于解析dump中的表,甚至可以通過(guò)shell等編程方式來(lái)實(shí)現(xiàn)。
- 關(guān)于外鍵
在導(dǎo)入dump文件的時(shí)候,外鍵也是一個(gè)很重要的因素,因?yàn)閐ump文件含有的某些表中可能存在著外鍵,在數(shù)據(jù)遷移之類的項(xiàng)目中很讓人頭疼,需要基于外鍵考慮表的導(dǎo)入順序,否則,在數(shù)據(jù)插入時(shí)會(huì)報(bào)外鍵相關(guān)的ORA問(wèn)題。
可以使用以下腳本做一個(gè)過(guò)濾。在過(guò)濾條件中嵌入一個(gè)dump文件中表的清單,就可以更加精準(zhǔn)的處理相關(guān)的外鍵。
SELECT 'ALTER TABLE ' || TABLE_NAME || ' DISABLE CONSTRAINT ' ||CONSTRAINT_NAME || ';'FROM USER_CONSTRAINTSWHERE CONSTRAINT_TYPE = 'R' UNION SELECT 'ALTER TABLE ' || UCA.TABLE_NAME || ' DISABLE CONSTRAINT ' ||UCA.CONSTRAINT_NAME || ';'FROM USER_CONSTRAINTS UCA,(SELECT CONSTRAINT_NAMEFROM USER_CONSTRAINTSWHERE CONSTRAINT_TYPE IN ('P', 'U')) tmpWHERE UCA.CONSTRAINT_TYPE = 'R'AND tmp.constraint_name = UCA.r_constraint_name;- 關(guān)于觸發(fā)器
觸發(fā)器在數(shù)據(jù)導(dǎo)入或者遷移中是一個(gè)潛在問(wèn)題的爆發(fā)點(diǎn),如果你不了解應(yīng)用中的觸發(fā)器處理細(xì)節(jié),就會(huì)發(fā)現(xiàn)在數(shù)據(jù)導(dǎo)入或者遷移的過(guò)程中,會(huì)莫名奇妙多出來(lái)一部分?jǐn)?shù)據(jù),或者某些數(shù)據(jù)發(fā)生了變化。
一般來(lái)說(shuō),可以和開(kāi)發(fā)部門做簡(jiǎn)單的確認(rèn),大多數(shù)的情況下都是需要把觸發(fā)器給disable,等數(shù)據(jù)導(dǎo)入之后再啟用,如下所示:
SELECT 'ALTER TRIGGER ' || TRIGGER_NAME|| ' DISABLE ;' FROM USER_TRIGGERS;?
- 關(guān)于buffer size
buffer size 的設(shè)置在數(shù)據(jù)導(dǎo)入中也是很重要的;如果dump存在一個(gè)較大的分區(qū)表,很可能導(dǎo)入的過(guò)程中就會(huì)發(fā)現(xiàn)buffer_size不夠的錯(cuò)誤,給導(dǎo)入工作帶來(lái)很多影響。
一般可以把buffer size 設(shè)置得大一些,比如 4MB和9MB都是不錯(cuò)的選擇。
3 解析Datapump及常見(jiàn)問(wèn)題
Datapump 相比于exp/imp的最大差別就在于Datapump是屬于服務(wù)端的程序,生成的dump只能位于服務(wù)端,而不能把它導(dǎo)出到客戶端。
因?yàn)镈atapump是一個(gè)服務(wù)端的程序,所以需要指定本地的一個(gè)目錄結(jié)構(gòu),它會(huì)解析這個(gè)目錄然后把dump生成在這個(gè)目錄下面。
sys@cdb$root:orclcdb> create directory test_dir as '/home/oracle/expdp_test';Directory created.sys@cdb$root:orclcdb> grant read,write on directory test_dir to hr; grant read,write on directory test_dir to hr* ERROR at line 1: ORA-01917: user or role 'HR' does not existsys@cdb$root:orclcdb> ALTER SESSION SET CONTAINER=ORCLPDB1;Session altered.sys@cdb$root:orclcdb> grant read,write on directory test_dir to hr; grant read,write on directory test_dir to hr* ERROR at line 1: ORA-22930: directory does not existsys@cdb$root:orclcdb> create directory test_dir as '/home/oracle/expdp_test';Directory created.sys@cdb$root:orclcdb> grant read,write on directory test_dir to hr;Grant succeeded.sys@cdb$root:orclcdb>(1) 數(shù)據(jù)庫(kù)模式
數(shù)據(jù)庫(kù)模式主要是作為全庫(kù)備份使用的,可以導(dǎo)出除了SYS之外數(shù)據(jù)庫(kù)里的所有對(duì)象,在數(shù)據(jù)量較小的情況下是一個(gè)不錯(cuò)的選擇。
[oracle@MaxwellDBA expdp_test]$ expdp system/system@ORCLPDB1 dumpfile=db_backup.dmp full=y directory=test_dirExport: Release 19.0.0.0.0 - Production on Thu Oct 6 15:23:27 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Starting "SYSTEM"."SYS_EXPORT_FULL_01": system/********@ORCLPDB1 dumpfile=db_backup.dmp full=y directory=test_dir Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA Processing object type DATABASE_EXPORT/SCHEMA/PACKAGE_BODIES/PACKAGE/PACKAGE_BODY Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/BITMAP_INDEX/INDEX_STATISTICS Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS Processing object type DATABASE_EXPORT/STATISTICS/MARKER Processing object type DATABASE_EXPORT/PRE_SYSTEM_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/PRE_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/TABLESPACE Processing object type DATABASE_EXPORT/PROFILE Processing object type DATABASE_EXPORT/SCHEMA/USER Processing object type DATABASE_EXPORT/ROLE Processing object type DATABASE_EXPORT/RADM_FPTM Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT Processing object type DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE Processing object type DATABASE_EXPORT/SCHEMA/ON_USER_GRANT Processing object type DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA Processing object type DATABASE_EXPORT/RESOURCE_COST Processing object type DATABASE_EXPORT/SCHEMA/DB_LINK Processing object type DATABASE_EXPORT/TRUSTED_DB_LINK Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/SEQUENCE Processing object type DATABASE_EXPORT/DIRECTORY/DIRECTORY Processing object type DATABASE_EXPORT/DIRECTORY/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type DATABASE_EXPORT/SCHEMA/SYNONYM Processing object type DATABASE_EXPORT/SCHEMA/TYPE/INC_TYPE Processing object type DATABASE_EXPORT/SCHEMA/TYPE/TYPE_SPEC Processing object type DATABASE_EXPORT/SCHEMA/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PRE_SYSTEM_ACTIONS/PROCACT_SYSTEM Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE Processing object type DATABASE_EXPORT/EARLY_POST_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/SCHEMA/XMLSCHEMA/XMLSCHEMA Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE Processing object type DATABASE_EXPORT/NORMAL_POST_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE Processing object type DATABASE_EXPORT/SCHEMA/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type DATABASE_EXPORT/SCHEMA/TABLE/COMMENT Processing object type DATABASE_EXPORT/SCHEMA/PACKAGE/PACKAGE_SPEC Processing object type DATABASE_EXPORT/SCHEMA/PACKAGE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type DATABASE_EXPORT/SCHEMA/PACKAGE/CODE_BASE_GRANT Processing object type DATABASE_EXPORT/SCHEMA/FUNCTION/FUNCTION Processing object type DATABASE_EXPORT/SCHEMA/PROCEDURE/PROCEDURE Processing object type DATABASE_EXPORT/SCHEMA/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC Processing object type DATABASE_EXPORT/SCHEMA/FUNCTION/ALTER_FUNCTION Processing object type DATABASE_EXPORT/SCHEMA/PROCEDURE/ALTER_PROCEDURE Processing object type DATABASE_EXPORT/SCHEMA/VIEW/VIEW Processing object type DATABASE_EXPORT/SCHEMA/VIEW/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type DATABASE_EXPORT/SCHEMA/VIEW/COMMENT Processing object type DATABASE_EXPORT/SCHEMA/TYPE/TYPE_BODY Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/BITMAP_INDEX/INDEX Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/DOMAIN_INDEX/INDEX Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TRIGGER Processing object type DATABASE_EXPORT/SCHEMA/VIEW/TRIGGER Processing object type DATABASE_EXPORT/SCHEMA/MATERIALIZED_VIEW Processing object type DATABASE_EXPORT/SCHEMA/DIMENSION Processing object type DATABASE_EXPORT/FINAL_POST_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/SCHEMA/TABLE/POST_INSTANCE/PROCACT_INSTANCE Processing object type DATABASE_EXPORT/SCHEMA/TABLE/POST_INSTANCE/PROCDEPOBJ Processing object type DATABASE_EXPORT/SCHEMA/TABLE/POST_INSTANCE/GRANT/PROCDEPOBJ_GRANT Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCOBJ Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA Processing object type DATABASE_EXPORT/AUDIT_UNIFIED/AUDIT_POLICY_ENABLE Processing object type DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER . . exported "SYS"."KU$_USER_MAPPING_VIEW" 6.289 KB 54 rows . . exported "AUDSYS"."AUD$UNIFIED":"SYS_P1981" 266.7 KB 445 rows . . exported "AUDSYS"."AUD$UNIFIED":"SYS_P2141" 112.4 KB 123 rows . . exported "AUDSYS"."AUD$UNIFIED":"SYS_P221" 101.0 KB 96 rows . . exported "SYSTEM"."REDO_DB" 25.59 KB 1 rows . . exported "WMSYS"."WM$WORKSPACES_TABLE$" 12.10 KB 1 rows . . exported "WMSYS"."WM$HINT_TABLE$" 9.984 KB 97 rows . . exported "LBACSYS"."OLS$INSTALLATIONS" 6.960 KB 2 rows . . exported "WMSYS"."WM$WORKSPACE_PRIV_TABLE$" 7.078 KB 11 rows . . exported "SYS"."DAM_CONFIG_PARAM$" 6.531 KB 14 rows . . exported "SYS"."TSDP_SUBPOL$" 6.328 KB 1 rows . . exported "WMSYS"."WM$NEXTVER_TABLE$" 6.375 KB 1 rows . . exported "LBACSYS"."OLS$PROPS" 6.234 KB 5 rows . . exported "WMSYS"."WM$ENV_VARS$" 6.015 KB 3 rows . . exported "SYS"."TSDP_PARAMETER$" 5.953 KB 1 rows . . exported "SYS"."TSDP_POLICY$" 5.921 KB 1 rows . . exported "WMSYS"."WM$VERSION_HIERARCHY_TABLE$" 5.984 KB 1 rows . . exported "WMSYS"."WM$EVENTS_INFO$" 5.812 KB 12 rows . . exported "LBACSYS"."OLS$AUDIT_ACTIONS" 5.757 KB 8 rows . . exported "LBACSYS"."OLS$DIP_EVENTS" 5.539 KB 2 rows . . exported "AUDSYS"."AUD$UNIFIED":"AUD_UNIFIED_P0" 0 KB 0 rows . . exported "LBACSYS"."OLS$AUDIT" 0 KB 0 rows . . exported "LBACSYS"."OLS$COMPARTMENTS" 0 KB 0 rows . . exported "LBACSYS"."OLS$DIP_DEBUG" 0 KB 0 rows . . exported "LBACSYS"."OLS$GROUPS" 0 KB 0 rows . . exported "LBACSYS"."OLS$LAB" 0 KB 0 rows . . exported "LBACSYS"."OLS$LEVELS" 0 KB 0 rows . . exported "LBACSYS"."OLS$POL" 0 KB 0 rows . . exported "LBACSYS"."OLS$POLICY_ADMIN" 0 KB 0 rows . . exported "LBACSYS"."OLS$POLS" 0 KB 0 rows . . exported "LBACSYS"."OLS$POLT" 0 KB 0 rows . . exported "LBACSYS"."OLS$PROFILE" 0 KB 0 rows . . exported "LBACSYS"."OLS$PROFILES" 0 KB 0 rows . . exported "LBACSYS"."OLS$PROG" 0 KB 0 rows . . exported "LBACSYS"."OLS$SESSINFO" 0 KB 0 rows . . exported "LBACSYS"."OLS$USER" 0 KB 0 rows . . exported "LBACSYS"."OLS$USER_COMPARTMENTS" 0 KB 0 rows . . exported "LBACSYS"."OLS$USER_GROUPS" 0 KB 0 rows . . exported "LBACSYS"."OLS$USER_LEVELS" 0 KB 0 rows . . exported "SYS"."AUD$" 0 KB 0 rows . . exported "SYS"."DAM_CLEANUP_EVENTS$" 0 KB 0 rows . . exported "SYS"."DAM_CLEANUP_JOBS$" 0 KB 0 rows . . exported "SYS"."TSDP_ASSOCIATION$" 0 KB 0 rows . . exported "SYS"."TSDP_CONDITION$" 0 KB 0 rows . . exported "SYS"."TSDP_FEATURE_POLICY$" 0 KB 0 rows . . exported "SYS"."TSDP_PROTECTION$" 0 KB 0 rows . . exported "SYS"."TSDP_SENSITIVE_DATA$" 0 KB 0 rows . . exported "SYS"."TSDP_SENSITIVE_TYPE$" 0 KB 0 rows . . exported "SYS"."TSDP_SOURCE$" 0 KB 0 rows . . exported "SYSTEM"."REDO_LOG" 0 KB 0 rows . . exported "WMSYS"."WM$BATCH_COMPRESSIBLE_TABLES$" 0 KB 0 rows . . exported "WMSYS"."WM$CONSTRAINTS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$CONS_COLUMNS$" 0 KB 0 rows . . exported "WMSYS"."WM$LOCKROWS_INFO$" 0 KB 0 rows . . exported "WMSYS"."WM$MODIFIED_TABLES$" 0 KB 0 rows . . exported "WMSYS"."WM$MP_GRAPH_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$MP_PARENT_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$NESTED_COLUMNS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RESOLVE_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RIC_LOCKING_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RIC_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RIC_TRIGGERS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$UDTRIG_DISPATCH_PROCS$" 0 KB 0 rows . . exported "WMSYS"."WM$UDTRIG_INFO$" 0 KB 0 rows . . exported "WMSYS"."WM$VERSION_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$VT_ERRORS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$WORKSPACE_SAVEPOINTS_TABLE$" 0 KB 0 rows . . exported "MDSYS"."RDF_PARAM$" 6.515 KB 3 rows . . exported "SYS"."AUDTAB$TBS$FOR_EXPORT" 5.953 KB 2 rows . . exported "SYS"."DBA_SENSITIVE_DATA" 0 KB 0 rows . . exported "SYS"."DBA_TSDP_POLICY_PROTECTION" 0 KB 0 rows . . exported "SYS"."FGA_LOG$FOR_EXPORT" 0 KB 0 rows . . exported "SYS"."NACL$_ACE_EXP" 0 KB 0 rows . . exported "SYS"."NACL$_HOST_EXP" 6.914 KB 1 rows . . exported "SYS"."NACL$_WALLET_EXP" 0 KB 0 rows . . exported "SYS"."SQL$TEXT_DATAPUMP" 0 KB 0 rows . . exported "SYS"."SQL$_DATAPUMP" 0 KB 0 rows . . exported "SYS"."SQLOBJ$AUXDATA_DATAPUMP" 0 KB 0 rows . . exported "SYS"."SQLOBJ$DATA_DATAPUMP" 0 KB 0 rows . . exported "SYS"."SQLOBJ$PLAN_DATAPUMP" 0 KB 0 rows . . exported "SYS"."SQLOBJ$_DATAPUMP" 0 KB 0 rows . . exported "SYSTEM"."SCHEDULER_JOB_ARGS" 0 KB 0 rows . . exported "SYSTEM"."SCHEDULER_PROGRAM_ARGS" 0 KB 0 rows . . exported "WMSYS"."WM$EXP_MAP" 7.718 KB 3 rows . . exported "WMSYS"."WM$METADATA_MAP" 0 KB 0 rows . . exported "SH"."CUSTOMERS" 10.27 MB 55500 rows . . exported "SCOTT"."BIG_TABLE" 7.699 MB 54915 rows . . exported "SH"."SALES_FACT" 7.563 MB 111334 rows . . exported "OE"."PRODUCT_DESCRIPTIONS" 2.379 MB 8640 rows . . exported "SH"."SALES":"SALES_Q4_2001" 2.257 MB 69749 rows . . exported "SH"."SALES":"SALES_Q3_1999" 2.166 MB 67138 rows . . exported "SH"."SALES":"SALES_Q3_2001" 2.130 MB 65769 rows . . exported "SH"."SALES":"SALES_Q2_2001" 2.051 MB 63292 rows . . exported "SH"."SALES":"SALES_Q1_1999" 2.071 MB 64186 rows . . exported "SH"."SALES":"SALES_Q1_2001" 1.965 MB 60608 rows . . exported "SH"."SALES":"SALES_Q1_2000" 2.024 MB 62549 rows . . exported "SH"."SALES":"SALES_Q4_1999" 2.014 MB 62388 rows . . exported "SH"."SALES":"SALES_Q3_2000" 1.910 MB 58950 rows . . exported "SH"."SALES":"SALES_Q4_2000" 1.814 MB 55984 rows . . exported "SH"."SALES":"SALES_Q2_2000" 1.814 MB 55893 rows . . exported "SH"."SALES":"SALES_Q2_1999" 1.754 MB 54233 rows . . exported "SH"."SALES":"SALES_Q3_1998" 1.634 MB 50515 rows . . exported "SH"."SALES":"SALES_Q4_1998" 1.617 MB 49995 rows . . exported "SH"."SALES":"SALES_Q1_1998" 1.424 MB 44050 rows . . exported "SH"."SALES":"SALES_Q2_1998" 1.179 MB 36348 rows . . exported "SH"."TIMES" 741.8 KB 3652 rows . . exported "SH"."SUPPLEMENTARY_DEMOGRAPHICS" 697.6 KB 4500 rows . . exported "SH"."FWEEK_PSCAT_SALES_MV" 419.9 KB 11266 rows . . exported "OE"."PRODUCT_INFORMATION" 73.05 KB 288 rows . . exported "OE"."CUSTOMERS" 81.17 KB 319 rows . . exported "SH"."PROMOTIONS" 59.17 KB 503 rows ORA-39181: Only partial table data may be exported due to fine grain access control on "OE"."PURCHASEORDER". . exported "OE"."PURCHASEORDER" 247.7 KB 132 rows . . exported "SH"."PRODUCTS" 26.71 KB 72 rows . . exported "OE"."ORDER_ITEMS" 21.01 KB 665 rows . . exported "OE"."INVENTORIES" 21.76 KB 1112 rows . . exported "HR"."EMPLOYEES" 17.08 KB 107 rows . . exported "HR"."EMPLOYEES1" 17.09 KB 107 rows . . exported "HR"."EMPLOYEES2" 17.09 KB 107 rows . . exported "OE"."ORDERS" 12.59 KB 105 rows . . exported "SH"."COUNTRIES" 11.99 KB 46 rows . . exported "OE"."PRODUCT_REF_LIST_NESTEDTAB" 12.57 KB 288 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_S" 11.57 KB 1 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_S" 11.42 KB 5 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_S" 11.30 KB 4 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_S" 11.29 KB 3 rows . . exported "QS"."AQ$_AQ$_MEM_MC_S" 11.13 KB 1 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_S" 11.14 KB 1 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_S" 11.14 KB 1 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_S" 11.14 KB 1 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_S" 11.14 KB 1 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_S" 11.14 KB 1 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_S" 11.14 KB 1 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_S" 11.14 KB 1 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_H" 0 KB 0 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_I" 0 KB 0 rows . . exported "SCOTT"."EMP" 8.773 KB 14 rows . . exported "HR"."LOCATIONS" 8.437 KB 23 rows . . exported "OE"."CATEGORIES_TAB" 14.43 KB 22 rows . . exported "SH"."CHANNELS" 7.632 KB 10 rows . . exported "OE"."WAREHOUSES" 12.76 KB 9 rows . . exported "HR"."JOB_HISTORY" 7.195 KB 10 rows . . exported "HR"."JOBS" 7.140 KB 20 rows . . exported "HR"."DEPARTMENTS" 7.125 KB 27 rows . . exported "HR"."COUNTRIES" 6.367 KB 25 rows . . exported "SH"."CAL_MONTH_SALES_MV" 6.382 KB 48 rows . . exported "SCOTT"."DEPT" 6.023 KB 4 rows . . exported "SCOTT"."SALGRADE" 5.953 KB 5 rows . . exported "OE"."MEDIUM_CUSTOMERS" 5.828 KB 22 rows . . exported "OE"."LARGE_CUSTOMERS" 5.710 KB 13 rows . . exported "OE"."SMALL_CUSTOMERS" 5.679 KB 12 rows . . exported "HR"."REGIONS" 5.546 KB 4 rows . . exported "HR"."REGIONS2" 5.546 KB 4 rows . . exported "OE"."PROMOTIONS" 5.570 KB 2 rows . . exported "HR"."DEPT60_BONUSES" 5.507 KB 3 rows . . exported "OE"."SUBCATEGORY_REF_LIST_NESTEDTAB" 6.656 KB 21 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_G" 0 KB 0 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_L" 0 KB 0 rows . . exported "IX"."AQ$_ORDERS_QUEUETABLE_T" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_C" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_G" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_H" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_I" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_L" 0 KB 0 rows . . exported "IX"."AQ$_STREAMS_QUEUE_TABLE_T" 0 KB 0 rows . . exported "IX"."ORDERS_QUEUETABLE" 0 KB 0 rows . . exported "IX"."STREAMS_QUEUE_TABLE" 0 KB 0 rows . . exported "PM"."PRINT_MEDIA" 0 KB 0 rows . . exported "PM"."TEXTDOCS_NESTEDTAB" 0 KB 0 rows . . exported "QS"."AQ$_AQ$_MEM_MC_G" 0 KB 0 rows . . exported "QS"."AQ$_AQ$_MEM_MC_H" 0 KB 0 rows . . exported "QS"."AQ$_AQ$_MEM_MC_I" 0 KB 0 rows . . exported "QS"."AQ$_AQ$_MEM_MC_L" 0 KB 0 rows . . exported "QS"."AQ$_AQ$_MEM_MC_T" 0 KB 0 rows . . exported "QS"."AQ$_MEM_MC" 0 KB 0 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_G" 0 KB 0 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_H" 0 KB 0 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_I" 0 KB 0 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_L" 0 KB 0 rows . . exported "QS"."AQ$_QS_ORDERS_PR_MQTAB_T" 0 KB 0 rows . . exported "QS"."QS_ORDERS_PR_MQTAB" 0 KB 0 rows . . exported "QS"."QS_ORDERS_SQTAB" 0 KB 0 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_G" 0 KB 0 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_H" 0 KB 0 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_I" 0 KB 0 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_L" 0 KB 0 rows . . exported "QS_CBADM"."AQ$_QS_CBADM_ORDERS_MQTAB_T" 0 KB 0 rows . . exported "QS_CBADM"."QS_CBADM_ORDERS_MQTAB" 0 KB 0 rows . . exported "QS_CBADM"."QS_CBADM_ORDERS_SQTAB" 0 KB 0 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_G" 0 KB 0 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_H" 0 KB 0 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_I" 0 KB 0 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_L" 0 KB 0 rows . . exported "QS_CS"."AQ$_QS_CS_ORDER_STATUS_QT_T" 0 KB 0 rows . . exported "QS_CS"."ORDER_STATUS_TABLE" 0 KB 0 rows . . exported "QS_CS"."QS_CS_ORDER_STATUS_QT" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_G" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_H" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_I" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_L" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_MQTAB_T" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_G" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_H" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_I" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_L" 0 KB 0 rows . . exported "QS_ES"."AQ$_QS_ES_ORDERS_PR_MQTAB_T" 0 KB 0 rows . . exported "QS_ES"."QS_ES_ORDERS_MQTAB" 0 KB 0 rows . . exported "QS_ES"."QS_ES_ORDERS_PR_MQTAB" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_G" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_H" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_I" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_L" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_MQTAB_T" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_G" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_H" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_I" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_L" 0 KB 0 rows . . exported "QS_OS"."AQ$_QS_OS_ORDERS_PR_MQTAB_T" 0 KB 0 rows . . exported "QS_OS"."QS_OS_ORDERS_MQTAB" 0 KB 0 rows . . exported "QS_OS"."QS_OS_ORDERS_PR_MQTAB" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_G" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_H" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_I" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_L" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_MQTAB_T" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_G" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_H" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_I" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_L" 0 KB 0 rows . . exported "QS_WS"."AQ$_QS_WS_ORDERS_PR_MQTAB_T" 0 KB 0 rows . . exported "QS_WS"."QS_WS_ORDERS_MQTAB" 0 KB 0 rows . . exported "QS_WS"."QS_WS_ORDERS_PR_MQTAB" 0 KB 0 rows . . exported "SCOTT"."BONUS" 0 KB 0 rows . . exported "SCOTT"."CHILD" 0 KB 0 rows . . exported "SCOTT"."PARENT" 0 KB 0 rows . . exported "SCOTT"."T" 0 KB 0 rows . . exported "SCOTT"."T1" 0 KB 0 rows . . exported "SCOTT"."T2" 0 KB 0 rows . . exported "SCOTT"."TEST01" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_1995" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_1996" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_H1_1997" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_H2_1997" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_1998" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_1999" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_2000" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_2001" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_2002" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q1_2003" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_1998" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_1999" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_2000" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_2001" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_2002" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q2_2003" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_1998" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_1999" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_2000" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_2001" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_2002" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q3_2003" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_1998" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_1999" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_2000" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_2001" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_2002" 0 KB 0 rows . . exported "SH"."COSTS":"COSTS_Q4_2003" 0 KB 0 rows . . exported "SH"."SALES":"SALES_1995" 0 KB 0 rows . . exported "SH"."SALES":"SALES_1996" 0 KB 0 rows . . exported "SH"."SALES":"SALES_H1_1997" 0 KB 0 rows . . exported "SH"."SALES":"SALES_H2_1997" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q1_2002" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q1_2003" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q2_2002" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q2_2003" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q3_2002" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q3_2003" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q4_2002" 0 KB 0 rows . . exported "SH"."SALES":"SALES_Q4_2003" 0 KB 0 rows Master table "SYSTEM"."SYS_EXPORT_FULL_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_FULL_01 is:/home/oracle/expdp_test/db_backup.dmp Job "SYSTEM"."SYS_EXPORT_FULL_01" completed with 1 error(s) at Thu Oct 6 15:31:07 2022 elapsed 0 00:07:39[oracle@MaxwellDBA expdp_test]$(2)表模式
表模式可以導(dǎo)出某個(gè)用戶下指定的表
[oracle@MaxwellDBA expdp_test]$ expdp hr/hr@ORCLPDB1 dumpfile=table_mode.dmp tables=employees,jobs directory=test_dir Export: Release 19.0.0.0.0 - Production on Thu Oct 6 15:35:37 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Starting "HR"."SYS_EXPORT_TABLE_01": hr/********@ORCLPDB1 dumpfile=table_mode.dmp tables=employees,jobs directory=test_dir Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type TABLE_EXPORT/TABLE/COMMENT Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type TABLE_EXPORT/TABLE/TRIGGER . . exported "HR"."EMPLOYEES" 17.08 KB 107 rows . . exported "HR"."JOBS" 7.140 KB 20 rows Master table "HR"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for HR.SYS_EXPORT_TABLE_01 is:/home/oracle/expdp_test/table_mode.dmp Job "HR"."SYS_EXPORT_TABLE_01" successfully completed at Thu Oct 6 15:36:04 2022 elapsed 0 00:00:25[oracle@MaxwellDBA expdp_test]$(3)用戶模式
用戶模式可以導(dǎo)出指定用戶下所有的對(duì)象。
[oracle@MaxwellDBA expdp_test]$ expdp hr/hr@ORCLPDB1 file=user_mode.dmp schemas=hr directory=test_dir Export: Release 19.0.0.0.0 - Production on Thu Oct 6 15:39:04 2022 Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Legacy Mode Active due to the following parameters: Legacy Mode Parameter: "file=user_mode.dmp" Location: Command Line, Replaced with: "dumpfile=user_mode.dmp" Legacy Mode has set reuse_dumpfiles=true parameter. Starting "HR"."SYS_EXPORT_SCHEMA_01": hr/********@ORCLPDB1 dumpfile=user_mode.dmp schemas=hr directory=test_dir reuse_dumpfiles=true Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type SCHEMA_EXPORT/STATISTICS/MARKER Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type SCHEMA_EXPORT/TABLE/COMMENT Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE Processing object type SCHEMA_EXPORT/VIEW/VIEW Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/TRIGGER . . exported "HR"."EMPLOYEES" 17.08 KB 107 rows . . exported "HR"."EMPLOYEES1" 17.09 KB 107 rows . . exported "HR"."EMPLOYEES2" 17.09 KB 107 rows . . exported "HR"."LOCATIONS" 8.437 KB 23 rows . . exported "HR"."JOB_HISTORY" 7.195 KB 10 rows . . exported "HR"."JOBS" 7.140 KB 20 rows . . exported "HR"."DEPARTMENTS" 7.125 KB 27 rows . . exported "HR"."COUNTRIES" 6.367 KB 25 rows . . exported "HR"."REGIONS" 5.546 KB 4 rows . . exported "HR"."REGIONS2" 5.546 KB 4 rows . . exported "HR"."DEPT60_BONUSES" 5.507 KB 3 rows Master table "HR"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded ****************************************************************************** Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:/home/oracle/expdp_test/user_mode.dmp Job "HR"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Oct 6 15:40:37 2022 elapsed 0 00:01:31[oracle@MaxwellDBA expdp_test]$(4)可傳輸表空間模式。
可傳輸表空間模式常作為數(shù)據(jù)遷移時(shí)的一種方法。
總結(jié)
以上是生活随笔為你收集整理的Oracle 常用工具和问题分析的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: vim编辑页面怎么退出_linux系统中
- 下一篇: 一级域名怎么申请二级域名