PDB - Database command to open and close database.
KEYWARDS-
Open PDB database commands
- ALTER PLUGGABLE DATABASE PDB1 OPEN READ ONLY;
- ALTER PLUGGABLE DATABASE PDB2 OPEN UPGRADE RESTRICTED;
- ALTER PLUGGABLE DATABASE PDB1 OPEN READ WRITE FORCE;
- ALTER PLUGGABLE DATABASE PDB1 OPEN READ WRITE FORCE;
- ALTER PLUGGABLE DATABASE PDB3 OPEN READ ONLY RESTRICTED;
- ALTER PLUGGABLE DATABASE ALL EXCEPT PDB1 OPEN;
- ALTER PLUGGABLE DATABASE PDB1 CLOSE;
- ALTER PLUGGABLE DATABASE PDB2 CLOSE IMMEDIATE;
- ALTER PLUGGABLE DATABASE ALL CLOSE IMMEDIATE;
- ALTER PLUGGABLE DATABASE ALL CLOSE;
Example:
oracle@srv3:/u01/app/oracle/product/12.2.0/dbhome_1/network/admin> sqlplus sys/system123@SMRCDB as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Aug 5 18:27:58 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> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO
SQL> shut immediate;
oracle@srv3:/u01/app/oracle/product/12.2.0/dbhome_1/network/admin> sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Aug 5 18:28:37 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1795162112 bytes
Fixed Size 8793832 bytes
Variable Size 704643352 bytes
Database Buffers 1073741824 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN READ ONLY;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ ONLY NO
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN UPGRADE RESTRICTED;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ ONLY NO
4 PDB2 MIGRATE YES
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN READ WRITE FORCE;
Pluggable database altered.
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 MIGRATE YES
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE PDB3 OPEN READ ONLY RESTRICTED;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 MIGRATE YES
5 PDB3 READ ONLY YES
SQL> ALTER PLUGGABLE DATABASE ALL EXCEPT PDB1 OPEN;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO
SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MIGRATE YES
5 PDB3 READ ONLY YES
SQL> ALTER PLUGGABLE DATABASE PDB2 CLOSE IMMEDIATE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 READ ONLY YES
SQL> ALTER PLUGGABLE DATABASE ALL CLOSE IMMEDIATE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE ALL CLOSE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
Pluggable database altered.
- Close database PDB commands:
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO
SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MIGRATE YES
5 PDB3 READ ONLY YES
SQL> ALTER PLUGGABLE DATABASE PDB2 CLOSE IMMEDIATE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 READ ONLY YES
SQL> ALTER PLUGGABLE DATABASE ALL CLOSE IMMEDIATE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> ALTER PLUGGABLE DATABASE ALL CLOSE;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
No comments:
Post a Comment