Oracle 12c 学习之启动关闭CDB&PDB

1、默认登陆到CDB
<roidb01:cdb:/home/oracle>$sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Jan 20 11:01:46 2018

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

2、启动CDB
SQL> startup
ORACLE instance started.

Total System Global Area 1560281088 bytes
Fixed Size 2924784 bytes
Variable Size 956305168 bytes
Database Buffers 587202560 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
3、查看容器名
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

4、查看pdb
默认会有一个PDB$SEED,PDB1是通过模版创建的。
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
5、默认pdb未启动,手动启动pdb
SQL> alter pluggable database all open;

Pluggable database altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
6、关闭pdb
SQL> alter pluggable database pdb1 close;

Pluggable database altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
7、pdb只读打开
SQL> alter pluggable database pdb1 open read only;

Pluggable database altered.

8、切换到pdb1
SQL> alter session set container=pdb1 ;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB1
9、也可以这样启动pdb
SQL> shutdown immediate;
Pluggable Database closed.
SQL> startup
Pluggable Database opened.
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDB1 READ WRITE NO

10、切换到cdb,关闭cdb的同时,pdb也会跟着关闭
SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

原文地址:http://blog.51cto.com/roidba/2063116

时间: 2024-10-08 19:58:54

Oracle 12c 学习之启动关闭CDB&PDB的相关文章

oracle 12c 学习之三 nocdb 转换成pdb

01:23:06 [email protected]> select name, decode(cdb, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option" , open_mode, con_id from v$database; NAME Multitenant Option OPEN_MODE CON_ID --------- -----------------

oracle 12c 学习之三 pdb 的可拔插测试

DECLARE l_result BOOLEAN; BEGIN l_result := DBMS_PDB.check_plug_compatibility( pdb_descr_file => '/u02/pdb/pdb3.xml', pdb_name => 'pdb3'); IF l_result THEN DBMS_OUTPUT.PUT_LINE('compatible'); ELSE DBMS_OUTPUT.PUT_LINE('incompatible'); END IF; END; /

Oracle 12c 数据库的启动与关闭

(一)数据库的启动启动(STARTUP)一个数据库需要三个步骤.1.启动Oralce实例2.由实例装载数据库3.打开数据库·1) STARTUP NOMOUNTNOMOUNT 选项仅仅启动一个Oracle实例·2) STARTUP MOUNTSTARTUP MOUNT 命令启动实例并装载数据库·3)STARTUPSTARTUP 命令完成启动实例.装载数据库和打开数据库· ·如果采用STARTUP NOMOUNT 的数据库打开方式,就必须采用ALTER DATABASE命令来执行装载和打开数据库的

Oracle 12C -- clone a non-cdb as a pdb

将non-CDB置为只读模式: $ sqlplus '/as sysdba' SQL> select name, decode(cdb, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option" , open_mode, con_id from v$database; NAME Multitenant Option OPEN_MODE CON_ID --------- -

oracle 12c 学习

1.不可见字段 SQL> create table ht (a number,b varchar2(20) invisible); Table created. SQL> desc ht; Name Null? Type ----------------------------------------- -------- ---------------------------- A NUMBER SQL> set colinvisible on SQL> desc ht; Name

oracle 12c 创建PDB用户即Local User (PDB与CDB)

Oracle 12C用户创建与表空间分配 数据库安装完成后,首先用系统用户链接数据库容器(CDB), 在数据库容器(CDB)中创建表空间‘imei’ SQL>create tablespace iemi datafile'E:\Oracle_DB\ cdb_iemi.dbf'size 10240m autoextend on next 200m; 表空间已创建. 接下来在Oracle 12C数据库中创建用户时会报ORA-65096错误. SQL> create user imei identi

Oracle 12c 使用scott等普通用户的方法

目录: 一.前言 二.使用普通用户 三.自动启动PDB 一.前言 最近电脑上安装了oracle 12c数据库,想体验下新特性.安装完后,便像11g一样在dos窗口进行下面的操作: SQL*Plus: Release 12.1.0.2.0 Production on 星期日 8月 9 13:06:33 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. 连接到: Oracle Database 12c Enterprise Edi

Oracle 12c 安装及配置

Oracle 12c R2 for Windows_X64 安装 1.安装准备 1.1 下载Oracle for Windows版本 官方下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html 1.2 解压zip压缩包文件 解压下载的压缩包文件至同一目录中,目录中避免出现汉字和空格,如某目录下的database文件夹中,解压后的文件目录结构如下:  2.安装过程 2.1 执行安

Oracle 12c Data Guard 搭建手册

Oracle 12c 的DataGuard 是在CDB 级别进行的,所以我们的配置都是从CDB角度出发. 测试里主备库的数据库CDB名称相同. 1  环境说明 OS Version: [[email protected] etc]# cat /etc/oracle-release Oracle Linux Server release 6.3 [[email protected] etc]# uname -r 2.6.39-200.29.3.el6uek.x86_64 DB Version: S