- Drop and Create Pluggable Databases
- Clone Pluggable Database To Another Host by Dblink
- Oracle Pluggable Database PDB Open Close and Status
- Covert PDB from Unicode ALL32UTF8 to Different Characterset
- Datapump Export and Import From Pluggable Database (PDB)
- Directly with SYS user as SYSDBA Without Password
- Create Pluggable TEST Database From NonCDB Database Clone in Oracle 19c with DB Link
Drop and Create Pluggable Databases
ALTER PLUGGABLE DATABASE <DB> CLOSE;
DROP PLUGGABLE DATABASE <DB> INCLUDING DATAFILES;
CREATE PLUGGABLE DATABASE <DB> ADMIN USER PDBADMIN IDENTIFIED BY <Password>;
ALTER PLUGGABLE DATABASE <DB> OPEN;
Clone Pluggable Database To Another Host by Dblink
## Create Dblink at Target Host
SQL> create database link clone_link connect to system identified by <system_user_password> using '<SOURCE_CDB_NAME>';
## Test dblink
SQL> desc help@clone_link;
## Grant permisstion at Source Host and PDB
SQL> alter session set container=<Source_PDB>;
SQL> grant CREATE PLUGGABLE DATABASE to SYSTEM;
## Start to clone
SQL> create pluggable database <New_PDB> from <Source_PDB>@clone_link;
Oracle Pluggable Database PDB Open Close and Status
-- Open Only <PDB_NAME> pluggable database
alter pluggable database <PDB_NAME> open;
-- Open all pluggable databases
alter pluggable database all open;
-- Open close only <PDB_NAME> pluggable database
alter pluggable database <PDB_NAME> close immediate;
-- Open close all pluggable databases
alter pluggable database all close immediate;
-- Show status of Pluggable Databases
select name, open_mode from v$pdbs;
Covert PDB from Unicode ALL32UTF8 to Different Characterset
sqlplus / as sysdba
alter session set container=<PDB_NAME>;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER DATABASE CHARACTER SET INTERNAL_USE WE8ISO8859P9;
ALTER SYSTEM DISABLE RESTRICTED SESSION;
select value from NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET';
Datapump Export and Import From Pluggable Database (PDB) Directly with SYS user as SYSDBA Without Password
export ORACLE_PDB_SID=<PDB_SID_NAME>
impdp \'/ as sysdba\' parfile=ParameterFileName.par
Create Pluggable TEST Database From NonCDB Database Clone in Oracle 19c with DB Link
. /home/oracle/.oracle_profile
cd /oracle/script/
tarih=`date +%Y_%m_%d`
echo STARTING...
sqlplus / as sysdba <<EOF
set echo on
set heading on
ALTER PLUGGABLE DATABASE TEST CLOSE IMMEDIATE;
DROP PLUGGABLE DATABASE TEST INCLUDING DATAFILES;
create pluggable database TEST from <PROD_SID>@<PRODUCTION_DB_LINK_NAME>;
alter pluggable database TEST open;
alter session set container = TEST;
-- If copy from noncdb database
@/oracle/product/19.3/dbhome_1/rdbms/admin/noncdb_to_pdb.sql
-- You can modify clone data at new pluggable database with custom after_clone.sql
@/oracle/script/after_clone.sql;
alter system disable restricted session;
show pdbs
exit;
EOF
echo FINISHED.
Etiketler :
Oracle