ORACLE 19c 操作相关记录

#数据源导出导入
#导出
exp oracle/oracle@localhost:1521/orcl file=/home/oracle/dmp/oracle20191120.dmp owner=oracle log=/home/oracle/dmp/log.log
#导入
imp oracletest/oracletest@localhost:1521/orcl file=/home/oracle/dmp/oracle20191120.dmp full=y  ignore=y log=/home/oracle/dmp/implog.log

#oracle用户
su - oracle
sqlplus /nolog;
conn /as sysdba;

#必须用cdb$root下创建
alter session set container=cdb$root;

show con_name
#查看已有pdb
show pdbs
#查看已有pdb的datafile文件
select name from v$datafile;
#查看已有pdb的tempfile文件
select name from v$tempfile;

#查看DB_CREATE_FILE_DEST缺省路径
show parameter DB_CREATE_FILE_DEST;
#改变DB_CREATE_FILE_DEST缺省路径
alter system set db_create_file_dest='/home/app/oradata/MYORACLE/myoracle/';

#创建pdb
#create pluggable database myoracledb admin user myoracle identified by myoracle;
#create pluggable database myoracledb ADMIN USER myoracle IDENTIFIED BY myoracle default tablespace MYORACLE datafile '/home/app/oradata/MYORACLE/myoracle/MYORACLE.dbf';
create pluggable database myoracledb ADMIN USER myoracle IDENTIFIED BY myoracle file_name_convert=('/home/app/oradata/MYORACLE/pdbseed/','/home/app/oradata/MYORACLE/myoracle/');
create pluggable database myoracledb ADMIN USER myoracle IDENTIFIED BY myoracle default tablespace MYORACLE datafile '/home/app/oradata/MYORACLE/myoracle/MYORACLE.dbf' PATH_PREFIX = '/home/app/oradata/MYORACLE/myoracle/' file_name_convert=('/home/app/oradata/MYORACLE/pdbseed/','/home/app/oradata/MYORACLE/myoracle/');

##切换到pdb
alter session set container=myoracledb; 
# #将可插拔的数据库容器pdb打开
alter pluggable database myoracledb open;

show con_name pdbs;

#建立表空间
Create temporary tablespace MYORACLE_TEMP tempfile '/home/app/oradata/MYORACLE/myoracle/MYORACLE_TEMP.dbf' size 50m autoextend on next 50m;
Create tablespace MYORACLE logging datafile '/home/app/oradata/MYORACLE/myoracle/MYORACLE.dbf' size 512m autoextend on next 128m;
#删除表空间
#drop tablespace MYORACLE_TEMP including contents and datafiles;

#create user c##myoracle identified by myoracle default tablespace MYORACLE temporary tablespace MYORACLE_TEMP;
create user myoracle identified by myoracle default tablespace MYORACLE temporary tablespace MYORACLE_TEMP;
#DROP USER myoracle CASCADE;
#grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to myoracle;
grant all privileges to myoracle;
grant sysdba to myoracle;
grant imp_full_database to myoracle;

#imp myoracle/[email protected]:1521/myoracledb file=/home/oracle/databak/oracle20191121.dmp log=/home/oracle/databak/oracle20191121.dmp.log fromuser=oracle touser=myoracle

 

你可能感兴趣的:(oracle)