Seed Database (pdb$seed) - Read Write OR Read Only Mode in Oracle Database 12c
1. Check the instance and check the pluggable databases.
[oracle@Server ~]$ ps -ef | grep pmon
oracle 3268 1 0 07:40 ? 00:00:00 ora_pmon_cdb1
oracle 4235 4205 0 08:00 pts/1 00:00:00 grep pmon
[oracle@Server ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The Oracle base has been set to /u01/app/oracle
[oracle@Server ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Tue Feb 10 08:00:34 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ -----------------
2 PDB$SEED READ ONLY
3 PDB_AUDIT MOUNTED
2. Perform close instance operation in seed database (pdb$seed)
SQL> alter pluggable database pdb$seed close;
alter pluggable database pdb$seed close
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
3. Set the parameter "_oracle_script" and close the seed database (pdb$seed)
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED MOUNTED
3 PDB_AUDIT MOUNTED
4. Open the seed database in Read-Write Mode
SQL> alter pluggable database pdb$seed open read write;
Pluggable database altered.
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ WRITE
3 PDB_AUDIT MOUNTED
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
SQL> create tablespace example;
Tablespace created.
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
EXAMPLE
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- ------------------
2 PDB$SEED READ WRITE NO
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> create pluggable database cdb1_pdb1 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- -------------------
2 PDB$SEED READ WRITE NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
SQL> create pluggable database cdb1_pdb2 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------- ------------------
2 PDB$SEED READ WRITE NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> alter pluggable database pdb$seed close immediate instances=all;
alter pluggable database pdb$seed close immediate instances=all
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
alter pluggable database pdb$seed close immediate instances=all
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> sho con_id
CON_ID
------------------------------
1
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- -------------------
2 PDB$SEED MOUNTED
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> create pluggable database cdb1_pdb3 admin user user1 identified by oracle;
create pluggable database cdb1_pdb3 admin user user1 identified by oracle
*
ERROR at line 1:
ORA-65036: pluggable database PDB$SEED not open in required mode
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed open read only;
Pluggable database altered.
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
2 PDB$SEED READ ONLY NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> create pluggable database cdb1_pdb3 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
2 PDB$SEED READ ONLY NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
6 CDB1_PDB3 MOUNTED
[oracle@Server ~]$ ps -ef | grep pmon
oracle 3268 1 0 07:40 ? 00:00:00 ora_pmon_cdb1
oracle 4235 4205 0 08:00 pts/1 00:00:00 grep pmon
[oracle@Server ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The Oracle base has been set to /u01/app/oracle
[oracle@Server ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.2.0 Production on Tue Feb 10 08:00:34 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ -----------------
2 PDB$SEED READ ONLY
3 PDB_AUDIT MOUNTED
2. Perform close instance operation in seed database (pdb$seed)
SQL> alter pluggable database pdb$seed close;
alter pluggable database pdb$seed close
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
3. Set the parameter "_oracle_script" and close the seed database (pdb$seed)
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED MOUNTED
3 PDB_AUDIT MOUNTED
4. Open the seed database in Read-Write Mode
SQL> alter pluggable database pdb$seed open read write;
Pluggable database altered.
SQL> select con_id, name, open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ WRITE
3 PDB_AUDIT MOUNTED
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
SQL> create tablespace example;
Tablespace created.
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
EXAMPLE
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- ------------------
2 PDB$SEED READ WRITE NO
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> show con_id
CON_ID
------------------------------
1
SQL> create pluggable database cdb1_pdb1 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- -------------------
2 PDB$SEED READ WRITE NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
SQL> create pluggable database cdb1_pdb2 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------- ------------------
2 PDB$SEED READ WRITE NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> alter pluggable database pdb$seed close immediate instances=all;
alter pluggable database pdb$seed close immediate instances=all
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
alter pluggable database pdb$seed close immediate instances=all
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed close immediate instances=all;
Pluggable database altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> sho con_id
CON_ID
------------------------------
1
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ----------------- -------------------
2 PDB$SEED MOUNTED
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> create pluggable database cdb1_pdb3 admin user user1 identified by oracle;
create pluggable database cdb1_pdb3 admin user user1 identified by oracle
*
ERROR at line 1:
ORA-65036: pluggable database PDB$SEED not open in required mode
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set container=PDB$SEED;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB$SEED
SQL> show con_id
CON_ID
------------------------------
2
SQL> alter pluggable database pdb$seed open read only;
alter pluggable database pdb$seed open read only
*
ERROR at line 1:
ORA-65017: seed pluggable database may not be dropped or altered
SQL> alter session set "_oracle_script"=TRUE;
Session altered.
SQL> alter pluggable database pdb$seed open read only;
Pluggable database altered.
SQL> connect sys/oracle@cdb1 as sysdba
Connected.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
2 PDB$SEED READ ONLY NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
SQL> create pluggable database cdb1_pdb3 admin user user1 identified by oracle;
Pluggable database created.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ------------------ ----------
2 PDB$SEED READ ONLY NO
3 PDB_AUDIT MOUNTED
4 CDB1_PDB1 MOUNTED
5 CDB1_PDB2 MOUNTED
6 CDB1_PDB3 MOUNTED
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18903360/viewspace-2132333/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 3.2.3 Opening a Database in Read-Only ModeDatabase
- Open a Database in Read-Only Mode (301)Database
- Oracle 12C -- 使用seed PDB建立新的pdbOracle
- Innodb Read Only Mode
- ORA-16433 The database must be opened in read write mode故障解決Database
- Read-Only Tables in Oracle Database 11g Release 1OracleDatabase
- 事務的read only mode
- 當從READ ONLY到READ WRITE都做什麼了
- oracle 表空間和表 read only遷移後不再read onlyOracle
- HDFS read and write
- write&read&open
- Oracle Isolation Levels : Read-only (317)Oracle
- 4.3.2.3 關於PDB$SEED資料檔案的屬性
- 【PDB】Oracle 建立pdb說明(create pluggable database)OracleDatabase
- Oracle資料庫表空間READ ONLY、READ WRITE、ONLINE、OFFLINE狀態對應CHECKPOINT的變化Oracle資料庫
- read only tablespace backup restoreREST
- nodejs read/write fileNodeJS
- No read or write permission to ORACLE_HOME/.patch_storageOracle
- mysql [ERROR] InnoDB: ./ibdata1 can't be opened in read-write modeMySqlError
- 如何不使用 trn log 將read only (且能使用trn 恢復)的庫設定為read/write
- 2.3.1.4 Application SeedAPP
- open physical standby 為read write
- Oracle常見等待事件之direct path read/writeOracle事件
- 關於tablespace在read only狀態下的DML ,DDL操作--Read-Only Tablespaces
- oracle實驗記錄 (恢復read only tablespace(1))Oracle
- oracle實驗記錄 (恢復read only tablespace(2))Oracle
- CSS :read-only 選擇器CSS
- CSS :read-write 選擇器CSS
- pread,pwrite,read,write區別
- direct path read/write等待的分析
- SRAM的Write Assist與Read Assist
- 4.3.2.2 關於CDB Root和PDB$SEED檔案的名稱和位置
- cannot mount database in EXCLUSIVE modeDatabase
- Oracle Database 12C New FeatureOracleDatabase
- Read of flashback database logfile 502, block 251 found corrupted data.DatabaseBloC
- Oracle 11g 新特性:只讀表(Read-only)Oracle
- DG -- READ ONLY模式開啟物理Standby模式
- PHP artisan db:seed 報錯PHP