创建计划信息
序号 | 数据库实例 | 业务名称 | 用户名 | 表空间 | 临时表空间 | 表空间大小 | 临时表空间大小 |
---|---|---|---|---|---|---|---|
2 | orclda | 档案系统 | Usr01 | t_dag_d | TEMP | 50M(自动扩展,每次50M) | 437 |
PDB: orclda
PDBuser: PDBadmin passwd: PDBpasswd
表空间名称: t_dag_d
临时表空间名称:TEMP
用户:user01
密码:passwd;
别的用户 可以通过 PDBuser 登陆创建
ssh登陆到服务器操作系统
ssh 到oda 系统
ssh [email protected]
切换到oracle 用户
su - oracle
初始化环境变量
. oraenv sust1 #输入节点1 的sid [oracle@ora01 ~]$ . oraenv ORACLE_SID = [oracle] ? zhsgbk The Oracle base has been set to /u01/app/oracle [oracle@ora01 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Thu Jul 23 16:28:19 2020Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 ORCL READ WRITE NO 4 YYY READ WRITE NO --------
创建PDB
创建新PDB
create pluggable database orcl admin user PDBadmin identified by PDBpasswd;
打开新建的PDB
alter pluggable database orcl open;
修改字符集
alter pluggable database orcl open; alter pluggable database orcl open; alter session set container=orcl; alter pluggable database orcl close immediate; alter pluggable database open read write restricted; alter database character set internal_use zhs16gbk; alter pluggable database orcl close immediate; alter pluggable database orcl open; select userenv('language') from dual; # 打开新建的PDB alter pluggable database orcl open;
切换到新建的PDB
alter session set container=orcl;
增加表空间文件
切换 PDB
alter session set container=orcl;
关闭180天 密码过期
SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME'; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED ;
查询表空间使用率
select a.tablespace_name, total, free, total-free as used from (select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b where a.tablespace_name = b.tablespace_name;
查询DPB文件
select * form dba_data_files;select file_name from dba_data_files;
创建表空间
create tablespace t_dag_d datafile size 30g autoextend on next 1024m; alter tablespace t_dag_d add datafile size 10G autoextend on next 10M;
创建临时表空间
临时表空间名称:TEMP create temporary tablespace TEMP tempfile size 1g ; alter tablespace TEMP add tempfile size 1G autoextend on next 10M;
查看权限
col GRANTEE format a10 select con_id,grantee,granted_role from cdb_role_privs where grantee='PORTALADMIN'; select con_id,grantee,table_name,privilege from cdb_tab_privs where grantee='PDB_DBA'; select con_id,grantee,table_name,privilege from cdb_tab_privs where grantee='DBA';
创建日志
SQL> create pluggable database orcl admin user PDBadmin identified by PDBpasswd; Pluggable database created. SQL> alter pluggable database orcl open; Pluggable database altered. SQL> alter session set container=orcl; Session altered. SQL> SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME'; #### PROFILERESOURCE_NAME RESOURCE -------------------------------- --------#### LIMITCOM INH IMP --- --- --- DEFAULT PASSWORD_LIFE_TIME PASSWORD 180 NO NO NO SQL> SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED ; Profile altered. SQL> SQL> create tablespace t_dag_d datafile size 20g autoextend on next 1g; Tablespace created. SQL> alter tablespace t_dag_d add datafile size 20g autoextend on next 1g; Tablespace altered. SQL> alter tablespace t_dag_d add datafile size 10g autoextend on next 1g; Tablespace altered. SQL> create user usr01 identified by passwd; User created. SQL> grant dba to usr01;Grant succeeded.