您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)Oracle 12c多租戶常用管理命令有哪些的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
--進(jìn)入cdb
sqlplus /nolog
conn sys/sys as dba
--查看數(shù)據(jù)庫基本信息
select name,cdb from v$database;
--查看容器的相關(guān)信息
select con_id,name from v$containers;
--查看數(shù)據(jù)文件的路徑
select con_id,file_name from cdb_data_files order by 1;
--顯示當(dāng)前連接容器信息
show con_id con_name user
--顯示所有pdb
show pdbs
--start和stop根容器
--啟動(dòng)數(shù)據(jù)
--CDB
sqlplus / as sysdba
startup
--PDB(所有PDB)
alter pluggable database all open;
--啟動(dòng)pdb1庫
alter pluggable database pdb1 open;
--關(guān)閉數(shù)據(jù)庫
--CDB
shutdown immediate
--pdb1
alter pluggable database pdb1 close;
alter pluggable database pdb1 close immediate;
--關(guān)閉所有pdb
alter pluggable database all close immediate;
--創(chuàng)建公用用戶(sys和system在可插拔中就是自動(dòng)創(chuàng)建的公用用戶)
sqlplus / as sysdba
create user c#dba identified by alex;
--創(chuàng)建公用角色
sqlplus / as sysdba
create role c##dbaprivs container=all;
grant dba to c##dbaprivs container=all;
--公用角色給公用用戶
grant c##dbaprivs to c#dba container=all;
--切換容器
alter session set container=ehrpdb;
--切換回根容器
alter session set container=cdb$root;
--2創(chuàng)建可插拔數(shù)據(jù)庫
--2.1克隆種子容器
create pluggable database cpcdb
admin user cpcadm identified by cpcadm
file_name_convert=('/oracle/app/oracle/oradata/edw/pdbseed','/oradata/edw/cpcdb/datafile/');
--2.2直接創(chuàng)建數(shù)據(jù)庫
CREATE PLUGGABLE DATABASE hrdb
ADMIN USER hrdba IDENTIFIED BY hrdba
STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G)
DEFAULT TABLESPACE hrdb DATAFILE '/oradata/EDW/hrdb/datafile/hrdb001.dbf' SIZE 512M AUTOEXTEND on next 8M maxsize 10G;
CREATE PLUGGABLE DATABASE cpcdb
ADMIN USER cpcdba IDENTIFIED BY cpcdba
STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G)
DEFAULT TABLESPACE tbscpc DATAFILE '/oradata/EDW/cpcdb/datafile/tbscpc001.dbf' SIZE 512M AUTOEXTEND on next 8M maxsize 10G;
--2.3創(chuàng)建數(shù)據(jù)案例
create pluggable database cpcdb
admin user cpcadm identified by cpcadm
file_name_convert=('/oracle/app/oracle/oradata/edw/pdbseed','/oradata/edw/cpcdb/datafile/');
create pluggable database ncdb
admin user ncadm identified by ncadm
file_name_convert=('/oradata/edw/pdbseed','/oradata/edw/ncdb/datafile/');
CREATE PLUGGABLE DATABASE ncdb
ADMIN USER ncdba IDENTIFIED BY ncdba
STORAGE (MAXSIZE 100G MAX_SHARED_TEMP_SIZE 2G);
--訪問ncdb的插拔數(shù)據(jù)庫
sqlplus sys/ncdba@oraerp:1521/ncdb as sysdba
--關(guān)閉PDB數(shù)據(jù)庫
alter pluggable database ncdb close immediate;
alter pluggable database hrdb close immediate;
alter pluggable database cpcdb close immediate;
alter pluggable database edwpdb close immediate;
--刪除PDB數(shù)據(jù)庫
DROP PLUGGABLE DATABASE ncdb INCLUDING DATAFILES;
DROP PLUGGABLE DATABASE hrdb INCLUDING DATAFILES;
DROP PLUGGABLE DATABASE cpcdb INCLUDING DATAFILES;
DROP PLUGGABLE DATABASE edwpdb INCLUDING DATAFILES;
--創(chuàng)建pdb案例
--1、cpcdb
create pluggable database cpcdb
admin user cpcadm identified by cpcadm
file_name_convert=('/oradata/edw/pdbseed/','/oradata/edw/cpcdb/');
--2、ncdb
create pluggable database ncdb
admin user ncadm identified by ncadm
file_name_convert=('/oradata/edw/pdbseed/','/oradata/edw/ncdb/');
--3、hrdb
create pluggable database hrdb
admin user hradm identified by hradm
file_name_convert=('/oradata/edw/pdbseed/','/oradata/edw/hrdb/');
alter pluggable database all open;
--登錄cpcdb
$sqlplus sys/Oracleedw13@192.168.2.218:1531/cpcdb as sysdba
$sqlplus sys/OraEdw!23@192.168.1.105:1533/ncdb as sysdba --含有!需要單獨(dú)輸入密碼
感謝各位的閱讀!關(guān)于“Oracle 12c多租戶常用管理命令有哪些”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。