您好,登錄后才能下訂單哦!
這篇文章主要介紹“Oracle 12c nocdb怎么轉換成cdb”,在日常操作中,相信很多人在Oracle 12c nocdb怎么轉換成cdb問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Oracle 12c nocdb怎么轉換成cdb”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
Oracle 12c nocdb轉換成cdb
環境說明:
OS:Oracle Linux Server release 6.3
DB:Oracle 12.2.0.1.0
DBName:dapuchai
場景:
Oracle 11.2.0.4.0升級到Oracle 12.2.0.1.0,默認是no-cdb模式,升級后根據需要將no-cdb轉換成cdb里,即將之前的11.2.0.4.0數據完全遷移到PDB(Creating a PDB Using a Non-CDB);
實施方案:
一:連接non-CDB(dapuchai),生成XML格式數據庫描述文件
二:DBCA新建cdb數據庫(cjcdb)
三:Plug in the non-CDB (cjcpdb)
四:執行noncdb_to_pdb.sql
五:驗證數據
參考:https://docs.oracle.com/database/121/ADMIN/cdb_plug.htm#ADMIN13598
一: 連接non-CDB(dapuchai),生成XML格式數據庫描述文件
Connect to the non-CDB, and run the DBMS_PDB.DESCRIBE
procedure to construct an XML file that describes the non-CDB.
[root@cjc ~]# ps -ef|grep pmon
oracle 2677 1 0 22:35 ? 00:00:00 ora_pmon_dapuchai
root 3057 2634 0 22:37 pts/1 00:00:00 grep pmon
SQL> select name,cdb from v$database;
NAME CDB
--------- ---
DAPUCHAI NO
SQL> show pdbs
SQL> show con_id
CON_ID
------------------------------
0
SQL> shutdown immediate
---只讀方式打開dapuchai數據庫
SQL> startup open read only;
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------- -------------------- ---
DAPUCHAI READ ONLY NO
---生成xml格式的數據庫描述文件
SQL> BEGIN
DBMS_PDB.DESCRIBE(pdb_descr_file => '/home/oracle/20200113.xml');
END; 2 3
4 /
PL/SQL procedure successfully completed.
二:DBCA新建cdb數據庫(cjcdb)
[oracle@cjc ~]$ dbca
三:Plug in the non-CDB (cjcpdb)
[oracle@cjc oracle12]$ ps -ef|grep pmon
oracle 3106 1 0 22:38 ? 00:00:00 ora_pmon_dapuchai
oracle 4326 1 0 23:05 ? 00:00:00 ora_pmon_cjcdb
oracle 5651 3249 0 23:16 pts/1 00:00:00 grep pmon
[oracle@cjc ~]$ export ORACLE_SID=cjcdb
[oracle@cjc ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 13 23:18:52 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------- -------------------- ---
CJCDB READ WRITE YES
[oracle@cjc oradata]$ mkdir cjcpdb
[oracle@cjc oradata]$ cd cjcpdb/
[oracle@cjc cjcpdb]$ pwd
/u01/app/oracle12/oradata/cjcpdb
SQL> select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle12/oradata/cjcdb/users01.dbf
/u01/app/oracle12/oradata/cjcdb/undotbs01.dbf
/u01/app/oracle12/oradata/cjcdb/system01.dbf
/u01/app/oracle12/oradata/cjcdb/sysaux01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/system01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/sysaux01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/undotbs01.dbf
7 rows selected.
SQL> create pluggable database cjcpdb using '/home/oracle/20200113.xml' copy FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/dapuchai/', '/u01/app/oracle12/oradata/cjcpdb/');
Pluggable database created.
---數據文件遷移完成
[oracle@cjc cjcpdb]$ pwd
/u01/app/oracle12/oradata/cjcpdb
[oracle@cjc cjcpdb]$ ll -rth
total 2.5G
-rw-r----- 1 oracle oinstall 58M Jan 13 23:26 temp01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 ogg_temtbs01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 ogg_tbs01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 cjc_tbs01a.dbf
-rw-r----- 1 oracle oinstall 16M Jan 13 23:26 users01.dbf
-rw-r----- 1 oracle oinstall 446M Jan 13 23:26 undotbs01.dbf
-rw-r----- 1 oracle oinstall 1.2G Jan 13 23:26 system01.dbf
-rw-r----- 1 oracle oinstall 881M Jan 13 23:26 sysaux01.dbf
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CJCPDB MOUNTED
四:執行noncdb_to_pdb.sql
虛擬機內存只分配4G,并且是機械硬盤,腳本執行了1小時;
切換到PDB并執行腳本
SQL> alter session set container=cjcpdb;
SQL> @?/rdbms/admin/noncdb_to_pdb.sql
......
......
......
---啟動pdb
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 CJCPDB MOUNTED
SQL> alter pluggable database cjcpdb open;
Pluggable database altered.
告警日志查看pdb啟動過程;
五:驗證數據
[oracle@cjc ~]$ cd /u01/app/oracle12/product/12.2.0.1/db_1/network/admin/
[oracle@cjc admin]$ vi tnsnames.ora
......
CJCPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cjc)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CJCPDB)
)
)
---修改環境變量,指定cdb實例
[oracle@cjc ~]$ vi .bash_profile
......
#export ORACLE_SID=dapuchai
export ORACLE_SID=cjcdb
......
[oracle@cjc ~]$ source .bash_profile
---關掉no-cdb
到此,關于“Oracle 12c nocdb怎么轉換成cdb”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。