如何串連oracle 12c可插拔資料庫

來源:互聯網
上載者:User

標籤:grant   var   base   create   res   _id   範圍   contain   started   

啟動根容器:
[oracle@eric ~]$ export ORACLE_SID=cup
[oracle@eric ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jan 21 16:00:06 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup -----不會直接啟動所有可插拔資料庫,如需啟動所有可插拔資料庫,執行命令:alter pluggable database all open
ORACLE instance started.
Total System Global Area 767557632 bytes
Fixed Size 2929112 bytes
Variable Size 574623272 bytes
Database Buffers 184549376 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
停止根容器:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
查看是否建立了CDB,如果有顯示名字:
SQL> select name,cdb from v$database;
NAME CDB
--------- ---
CUP YES

SQL> show parameter service;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string cup
查看容器名字,其中有3個容器:根容器、種子容器和自己建立的容器:
SQL> select con_id,name from v$containers;

CON_ID NAME
---------- ------------------------------
1 CDB$ROOT ---根容器
2 PDB$SEED ---種子容器,只可讀
3 TEA ---自己建立的可插拔資料庫

SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbf

SQL> select file_name from cdb_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/oracle/app/oradata/CUP/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/CUP/datafile/o1_mf_users_bch0d15n_.dbf
建立公用使用者:
SQL> create user c##eric identified by gao;
User created.
SQL> conn c##eric/gao
ERROR:
ORA-01045: user C##ERIC lacks CREATE SESSION privilege; logon denied ----沒有許可權,我們可以單獨給其賦予許可權,也可以給其指定角色。
Warning: You are no longer connected to ORACLE.
SQL> conn / as sysdba
Connected.
SQL> grant dba to c##eric container=all; ---給其DBA角色,角色範圍覆蓋所有的容器
Grant succeeded.

SQL> conn c##eric/gao
Connected. ---串連成功

切換容器:
首先啟動自己建立的容器資料庫:
SQL> alter pluggable database tea open; ---首先啟動PDB資料庫

SQL> alter session set container = tea;

Session altered.

SQL> show con_name ---查看當前所在的容器名
CON_NAME
------------------------------
TEA
關閉可插拔資料庫:
SQL> alter pluggable database tea close immediate;
Pluggable database altered.

如何串連oracle 12c可插拔資料庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.