2.打开该文件并输入如下:(Database数据库名,ipaddress:ip地址,1521是端口),如我的目录是 D:\DevSuiteHome_2\NETWORK\ADMIN ,因为oracle版本不同9i可能是D:\DevSuiteHome_2\net80\ADMIN。
Database =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = IPAddress)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = Database_Name)
)
)
3.输入上列文件并且保存后在dos模式下输入
sqlplus username/password@databasename
sqlplus 打开sqlplus工具
username/password@databasenameme
用户名/密码@数据库名
启动根容器:[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 Buffers5455872 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 TYPEVALUE
------------------------------------ ----------- ------------------------------
service_namesstring 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 privilegelogon 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.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)