zoukankan      html  css  js  c++  java
  • oracle pdb基本管理

    1.创建PDB

    sqlplus /nolog
    conn / as sysdba
    
    CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1_admin IDENTIFIED BY ora123 ROLES=(DBA)
    	DEFAULT TABLESPACE USERS DATAFILE '/u01/app/oracle/oradata/orcl/pdb1/users01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M LOGGING
    	FILE_NAME_CONVERT=('/u01/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf','/u01/app/oracle/oradata/orcl/pdb1/sysaux01.dbf',
    		'/u01/app/oracle/oradata/orcl/pdbseed/system01.dbf','/u01/app/oracle/oradata/orcl/pdb1/system01.dbf',
    		'/u01/app/oracle/oradata/orcl/pdbseed/undotbs01.dbf','/u01/app/oracle/oradata/orcl/pdb1/undotbs01.dbf',
    		'/u01/app/oracle/oradata/orcl/pdbseed/temp012018-01-17_12-29-25-103-PM.dbf','/u01/app/oracle/oradata/orcl/pdb1/temp01.dbf');
    
    ALTER PLUGGABLE DATABASE pdb1 OPEN;
    
    exit;
    
    

    2.在$ORACLE_HOME/Network/admin/tnsnamses.ora中增加:

    pdb1 =  
      (DESCRIPTION =  
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))  
        (CONNECT_DATA =  
          (SERVER = DEDICATED)  
          (SERVICE_NAME = pdb1)  
        )  
      ) 
    

    完成编辑后,重启oracle监听

    3.使用pdb1_admin连接pdb1:sqlplus pdb1_admin/ora123@localhost/pdb1

    执行:

    CREATE TABLESPACE demo_data LOGGING DATAFILE '/u02/dbfile/pdb1/demo_data01.dbf' SIZE 1G AUTOEXTEND ON NEXT 1G;
    CREATE TEMPORARY TABLESPACE demo_temp TEMPFILE '/u02/dbfile/pdb1/demo_temp01.dbf' SIZE 5M AUTOEXTEND ON NEXT 1M;
    CREATE USER demo IDENTIFIED BY ora123 DEFAULT TABLESPACE demo_data TEMPORARY TABLESPACE demo_temp; 
    GRANT connect,resource TO demo;   
    

    4.常用SQL

    ALTER PLUGGABLE DATABASE pdb1 OPEN;
    ALTER PLUGGABLE DATABASE pdb1 CLOSE  IMMEDIATE;
    DROP PLUGGABLE DATABASE pdb1 INCLUDING DATAFILES;
    
    show pdbs;        
    show con_name;    
    ALTER SESSION SET CONTAINER = pdb1;
    
    SELECT tablespace_name FROM dba_tablespaces;
    SELECT name FROM v$datafile;
    SELECT name FROM v$tempfile;
    
  • 相关阅读:
    datadog数据json格式转换prometheus文本格式
    clickhouse聚合
    iOS面试
    程序员如何快速准备面试中的算法
    李刚OC语言疯狂讲义笔记
    传智播客内部 学习网站+书籍分享
    iOS-多线程总结笔记
    iOS-简化单例模式(定义成宏 以后通用)
    iOS-单例模式(懒汉式和饿汉式)和GCD实现
    iOS-队列组
  • 原文地址:https://www.cnblogs.com/javaite/p/8336261.html
Copyright © 2011-2022 走看看