Oracle 19c导入11g数据库
一、创建pdb
(1)使用oracle用户登录到cdb
# su – oracle
# sqlplus / as sysdba;
附oracle19c基本操作:
①查看容器名称,必须为 cdb$root,需要在根容器下创建pdb
查看:
# show con_name
如果不是cdb$root,手动切换:
# alter session set container=cdb$root;
② 查看已有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/';
(2)创建pdb(从种子pdb复制)
# create pluggable database pdbhsfa ADMIN USER hsfa IDENTIFIED BY 1 file_name_convert=('/oracle/app/oradata/ORCL/pdbseed','/oracle/app/oradata/ORCL/pdbhsfa');
(3)创建完pdb后,可以查看监听状态,会发现多了一个服务:
(4)将此服务设置到tns_name.ora中,就可以直接使用此服务名连接新建的pdb,例如:
二、创建表空间
(1)切换到pdb
#alter session set container=pdbhsfa;
或者(推荐):
Sqlplus 连接其它容器时:
# conn sys/oracle@hsfa
Oracle用户下:
sqlplus sys/oracle@hsfa
(2)将可插拔的数据库容器pdb打开
注:新建的pdb是mount状态,我们需要将他打开
# alter pluggable database myoracledb open;
另:关闭数据库操作:
# alter pluggable database myoracledb close;
(3)建立表空间
# create tablespace tbs_hsfa logging
datafile '/oracle/app/oradata/ORCL/pdbhsfa/tbs_hsfa.dbf' size 500M autoextend on next 500m maxsize 32767m extent management local;
---给表空间的额外链接表空间
# alter tablespace tbs_hsfa add datafile '/oracle/app/oradata/ORCL/pdbhsfa/tbs_hsfa2.dbf' size 500m autoextend on next 500m maxsize 32767m;
---另:删除表空间操作
drop tablespace tbs_hsfa including contents and datafiles;
(4)创建用户给默认表空间
create user hsfa identified by 1 default tablespace tbs_hsfa
---另:删除用户操作
DROP user hsfa CASCADE;
(5)给用户赋权限
#grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to myoracle;
grant all privileges to hsfa;
grant sysdba to hsfa;
grant imp_full_database to hsfa;
三、导入数据库
# imp hsfa/1@hsfa file=/home/oracle/dmpbak/home/oracle/dmpbak/hsfa_20210410.dmp full=y log=log.log buffer=20480000
标签:11g,create,alter,hsfa,oracle,tbs,Oracle,pdb
From: https://www.cnblogs.com/likaifei/p/16707090.html