zoukankan      html  css  js  c++  java
  • CDB命令方式创建和删除

    环境:centos7 、oracle12c

    oracle12c的容器数据库创建方式1、图形界面dbcahttps://www.cnblogs.com/wukc/p/13420063.html 2、直接命令方式

    1、容器数据库的组件

    1)ROOT组件 CDB$ROOT 存储Oracle提供元数据、Common User(每个容器都包含的用户)
    2)SEED组件 PDB$SEED 创建PDBS数据库的模板
    3)PDBS组件 CDB中可以有一个或多个PDBS
    唯一的CON_ID和名称

    2、创建容器数据库

    Create a Multitenant Container Database
    通过DBCA创建CDB和PDB
    使用sqlplus创建CDB1步骤
    1)启动实例
    [oracle@12c dbs]$ export ORACLE_SID=CDB1   --设置环境变量
    [oracle@12c dbs]$ echo $ORACLE_SID
    CDB1
    [oracle@12c oradata]$ mkdir -p /u01/app/oracle/oradata/CDB1
    [oracle@12c oradata]$ mkdir -p /u01/app/oracle/oradata/PDBSEED
    编辑参数文件
    [oracle@12c dbs]$ cd $ORACLE_HOME/dbs
    [oracle@12c dbs]$ touch initCDB1.ora
    [oracle@12c oradata]$ vim $ORACLE_HOME/dbs/initCDB1.ora 
    DB_NAME=CDB1
    DB_BLOCK_SIZE=8192
    CONTROL_FILES='/u01/app/oracle/oradata/CDB1/control01.ctl'
    ENABLE_PLUGGABLE_DATABASE=true
    [oracle@12c oradata]$ sqlplus / as sysdba
    SQL> startup nomount;
    2.创建数据库
    CREATE DATABASE命令 ENABLE PLUGGABLE DATABASE命令
    CREATE DATABASE CDB1
      USER SYS IDENTIFIED BY oracle
      USER SYSTEM IDENTIFIED BY oracle
      LOGFILE GROUP 1 ('/u01/app/oracle/oradata/CDB1/redo01a.log','/u01/app/oracle/oradata/CDB1/redo01b.log')
                 SIZE 100M BLOCKSIZE 512,
              GROUP 2 ('/u01/app/oracle/oradata/CDB1/redo02a.log','/u01/app/oracle/oradata/CDB1/redo02b.log')
                 SIZE 100M BLOCKSIZE 512,
              GROUP 3 ('/u01/app/oracle/oradata/CDB1/redo03a.log','/u01/app/oracle/oradata/CDB1/redo03b.log')
                 SIZE 100M BLOCKSIZE 512
      MAXLOGHISTORY 1
      MAXLOGFILES 16
      MAXLOGMEMBERS 3
      MAXDATAFILES 1024
      CHARACTER SET AL32UTF8
      NATIONAL CHARACTER SET AL16UTF16
      EXTENT MANAGEMENT LOCAL
      DATAFILE '/u01/app/oracle/oradata/CDB1/system01.dbf'
        SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
      SYSAUX DATAFILE '/u01/app/oracle/oradata/CDB1/sysaux01.dbf'
        SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
      DEFAULT TABLESPACE deftbs
        DATAFILE '/u01/app/oracle/oradata/CDB1/deftbs01.dbf'
        SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
      DEFAULT TEMPORARY TABLESPACE tempts1
        TEMPFILE '/u01/app/oracle/oradata/CDB1/temp01.dbf'
        SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
      UNDO TABLESPACE undotbs1
        DATAFILE '/u01/app/oracle/oradata/CDB1/undotbs01.dbf'
        SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
      ENABLE PLUGGABLE DATABASE
        SEED
        FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/CDB1/',
                             '/u01/app/oracle/oradata/PDBSEED/')               --通过cdb复制一个pdbseed
        SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
        SYSAUX DATAFILES SIZE 100M
      USER_DATA TABLESPACE usertbs
        DATAFILE '/u01/app/oracle/oradata/PDBSEED/usertbs01.dbf'
        SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
        
    3. Close/open the seed PDB and run postcreation scripts.
    SQL>alter session set "_oracle_script"=true;
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catalog.sql       --路径$ORACLE_HOME/rdbms/admin/catalog.sql
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catblock.sql
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catproc.sql
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catoctk.sql
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/owminst.plb
    SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/sqlplus/admin/pupbld.sql

     3、删除CDB

    cdb需要在mount限制登录模式下才能删除
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup mount;  
    SQL> alter system enable restricted session;     --限制登录模式
    System altered.
    SQL> drop database;
    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    actf_2019_babystack
    Exp9 Web安全基础
    Exp 8 Web基础
    Exp7 网络欺诈防范
    pwn堆总结
    基于OpenSSL的asn.1分析工具设计与实现 20175219罗乐琦 个人报告
    Exp6 MSF基础应用
    glibc free源码分析
    glibc malloc源码分析
    exp5 信息收集与漏洞扫描
  • 原文地址:https://www.cnblogs.com/wukc/p/13457413.html
Copyright © 2011-2022 走看看