12C把non-CDB的單庫匯入到CDB裡面當成PDB的方法
官方文件
原理:
在non-CDB裡面建立xml檔案,這樣non-CDB的xml檔案和資料檔案就組成了一個unplugged PDB,再在CDB裡面執行create pluggable database orcl using建立這個PDB,切換到這個PDB執行指令碼$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql,清除不屬於這個PDB的object,就可以正常啟動這個PDB了
結論1:所以沒有辦法在RMAN裡面把non-CDB的備份restore成CDB裡面的一個PDB,因為需要先把這個non-CDB變成一個unplugged PDB
結論2:該non-CDB的sys和system密碼變成了和CDB一樣,原來CDB的sys和system密碼都是123456,non-CDB的sys和system密碼都是666666,把該non-CDB當成PDB匯入CDB後,該PDB的sys和system密碼都是123456
結論3:該non-CDB的歸檔模式變成了和CDB一樣,原來CDB是歸檔模式,non-CDB是非歸檔模式,把該non-CDB當成PDB匯入CDB後,該PDB變成歸檔模式
結論4:該non-CDB當成PDB匯入CDB後,每個檔案的頭部都會重寫,檔案號也會更改
同一臺伺服器上安裝了兩套例項,non-CDB例項名稱為orcl,CDB例項名稱為ocp,把orcl當成PDB匯入到CDB
[oracle@ocp12c ~]$ lsnrctl status
...
Service "ocp" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pocp1" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
Service "pocp2" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
The command completed successfully
1、登入non-CDB,建立使用者user_orcl密碼為666666,system密碼為666666,建立表system.system2020
[oracle@ocp12c ~]$ ORACLE_SID=orcl
[oracle@ocp12c ~]$ sqlplus / as sysdba
SQL> show con_name;
CON_NAME
------------------------------
orcl
SQL> create user user_orcl identified by 666666;
SQL> grant dba to user_orcl;
SQL> conn system/666666
Connected.
SQL> create table system2020 as select * from dba_users;
2、關閉non-CDB資料庫並重啟至只讀狀態,再對non-CDB資料庫建立一個xml檔案
SQL> shutdown immediate;
SQL> startup open read only;
SQL> exec dbms_pdb.describe(pdb_descr_file=>'/home/oracle/orcl.xml');
3、關閉non-CDB資料庫
SQL> shutdown immediate;
4、登入CDB,必須要執行$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql,否則PDB啟動會有報錯
[oracle@ocp12c ~]$ ORACLE_SID=ocp
[oracle@ocp12c ~]$ sqlplus / as sysdba
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 POCP2 READ WRITE NO
5 POCP1 READ WRITE NO
SQL> create pluggable database orcl using '/home/oracle/orcl.xml' nocopy tempfile reuse;
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCL MOUNTED
4 POCP2 READ WRITE NO
5 POCP1 READ WRITE NO
SQL> select file_name from cdb_data_files a,cdb_pdbs b where a.con_id=b.con_id and b.pdb_name='ORCL';
no rows selected
SQL> select name from v$datafile a,cdb_pdbs b where a.con_id=b.con_id and b.pdb_name='ORCL';
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
SQL> alter session set container=ORCL;
Session altered.
SQL> startup
Warning: PDB altered with errors.
Pluggable Database opened.
SQL> shutdown immediate;
Pluggable Database closed.
SQL> startup
Warning: PDB altered with errors.
Pluggable Database opened.
SQL> shutdown immediate;
Pluggable Database closed.
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
SQL> startup
Pluggable Database opened.
--使用CDB的sys和system密碼才可以正常登入,原來non-CDB 的sys和system密碼變成了和CDB一樣
[oracle@ocp12c ~]$ sqlplus system/666666
ERROR:
ORA-01017: invalid username/password; logon denied
[oracle@ocp12c ~]$ sqlplus system/123456
SQL>
[oracle@ocp12c ~]$ sqlplus sys/666666@pocp1 as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
[oracle@ocp12c ~]$ sqlplus sys/123456@pocp1 as sysdba
SQL>
[oracle@ocp12c ~]$ lsnrctl status
...
Service "ocp" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
Service "pocp1" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
Service "pocp2" has 1 instance(s).
Instance "ocp", status READY, has 1 handler(s) for this service...
The command completed successfully
原來的non-CDB可以啟動到mount模式,再啟動到open模式報錯
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
alert檔案資訊為
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_38299.trc:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-1157 signalled during: ALTER DATABASE OPEN...
2020-02-19T18:57:28.276363+08:00
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_38301.trc:
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-01204: file number is 19 rather than 1 - wrong file
2020-02-19T18:57:30.142285+08:00
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_38301.trc:
ORA-01110: data file 3: '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-01204: file number is 20 rather than 3 - wrong file
2020-02-19T18:57:31.286909+08:00
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_38301.trc:
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/undotbs01.dbf'
ORA-01204: file number is 21 rather than 4 - wrong file
2020-02-19T18:57:31.649863+08:00
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_38301.trc:
ORA-01110: data file 7: '/u01/app/oracle/oradata/orcl/users01.dbf'
ORA-01204: file number is 22 rather than 7 - wrong file
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2676114/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 12c non-cdb升級成cdb模式Oracle模式
- Oracle 12c系列(七) | Non-CDB轉換為PDBOracle
- 1.3.2.2.2 通過Non-CDB(非CDB模式)建立PDB模式
- 1.3.2.2.2. 通過Non-CDB(非CDB模式)建立PDB模式
- 【12c cdb pdb】實驗
- 12C關於CDB、PDB建立AWR的方法和總結
- 12C關於CDB、PDB的官方解釋
- oracle 12c PDB隨CDB啟動和連結PDB的方式Oracle
- 【BAK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(三)CDB與PDB的備份方式Oracle
- 多租戶:在Oracle12.2中 從Non-CDB遷移到PDB,從PDB遷移另一個CDB中Oracle
- 【ASK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(一)什麼是CDB與PDB?Oracle
- Oracle 12C 中CDB和PDB的引數檔案管理Oracle
- 【CDB】怎樣轉換non-CDB to CDB
- 12C關於CDB、PDB引數的區別和總結
- oracle 12c中CDB和PDB的備份還原實驗Oracle
- 12C多租戶關於CDB、PDB的常用SQL語句SQL
- 12C關於CDB、PDB 臨時temp表空間的總結
- 12C關於CDB、PDB 回滾undo表空間的總結
- 12C關於CDB、PDB 日誌檔案redo log的總結
- IIS 日誌匯入到資料庫的方法資料庫
- 如何把某個網站的SSLServercertificate鏈匯入到ABAPNetweaver系統裡網站Server
- 【RECO_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(四)PDB的幾種恢復方式Oracle
- Oracle 12c nocdb轉換成cdbOracle
- 【CDB】Oracle CDB/PDB常用管理命令Oracle
- oracle 12c 針對cdb的差異0備與對pdb進行恢復Oracle
- 2.6.2 Overview of Flashback PDB in a CDBView
- 如何把某個網站的SSL Server certificate鏈匯入到ABAP Netweaver系統裡網站Server
- 3.1.2 CDB和PDB的職責分離
- Oracle 19c - 手動升級到 Non-CDB 19c 的完整核對清單 (Doc ID 2577572.1)Oracle
- Oracle 12C RAC CDB資料庫部署Oracle資料庫
- Oracle如何把一個表匯出匯入到另一個伺服器上的另一個表裡Oracle伺服器
- Oracle 12c系列(二)|PDB的建立Oracle
- win10把kms當成病毒怎麼辦_win10把kms當成病毒解決方法Win10
- 2.10.1 在non-CDB(非多租戶)環境中克隆資料庫資料庫
- Oracle 12c no-CDB轉換為CDBOracle
- 【CDB】怎樣修改PDB的記憶體引數記憶體
- 12c pdb基本操作
- 【資料庫升級】Oracle指令碼升級12c CDB to 19c CDB資料庫Oracle指令碼