拓扑园

  • O&M
    • Universal部署
    • PHP+VUE+Laravel相关
  • Oracle性能优化
  • Oracle项目案例
    • Oracle近期项目案例(目录)
    • Oracle实战问题解析(目录)
    • Oracle数据库名变更流程(2种方式)
    • Oracle数据库目录更换流程(使用Oracle的clone工具)
    • Oracle数据库迁移方案(目录)
    • 标准化文档系列
  • Oracle基础知识
    • LLL的Oracle培训(分类)
    • LLL的docker培训(分类)
    • 标准化文档系列--(分类)
    • Oracle核心经典分析(分类)
    • 图灵小队----(分类并包含以下文章)
    • --MySQL8.0/Oracle/Memcached/Redis等安装配置于RHEL/OL6/7/8.X系列-运行环境最优配置
    • --PG安装配置于RHEL/9X系列-运行环境最优配置
    • --自动维护任务详解-开启、关闭信息统计收集(统计信息)
    • --图灵小队—Oracle/PostgreSQL下创建一个用户测试表(自行定义数据行)
    • --图灵小队-Oracle存储过程导出表的明细_UTL_FILE(文章)
    • --图灵小队-Oracle数据库删除/卸载操作指南(文章)
    • --图灵小队-Oracle常用性能查询SQL语句(文章)
    • --图灵小队-Oracle数据库上线前检查(文章)
    • --图灵小队-Oracle常用SQL语句(文章)
    • --图灵小队—Linux/Oracle脚本/MySQL合集(持续更新)
    • --图灵小队-Oracle技巧记录(文章)
    • ADG
    • RAC
    • ASM
    • OGG
    • RMAN
    • EXPDP/IMPDP
    • 工厂数据导入导出系列
  • MySQL
    • MySQL数据库规范
    • MySQL项目案例
    • MySQL安装配置
    • MYSQL集群项目
    • MySQL常见处理
    • MySQL-Sysbench专题
    • MySQL-Percona Toolkit专题
  • Linux
    • Shell编程
    • kubernetes
    • docker
    • Linux
    • PHP
    • Nginx
    • haproxy
    • mail
    • 网站
    • 域名
    • 网址收藏
  • 数据中心
    • 新框架系统集合
    • 工作文档
    • EBS数据文件扩容
    • VMware虚拟化
    • EBS系列
    • 大数据
    • SVN
    • zabbix
    • SAP
    • 备份相关
    • FC交换机
    • SVN
  • K-Studing
    • D8-Python学习
    • Oracle/MySQl等面试题
    • LG-MySQL
    • LG-Docker/K8S
    • LG-PostgreSQL
    • LG-ORACLE_BBED
    • LG-ORACLE
    • LG-Elasticsearch(ES)+ELK
    • Oracle-19C-OCP
    • WERN_ORACLE培训
    • redis数据库
    • Nginx培训学习系列
  • 其他
    • 外研英语4年级下册-听力
    • 影视系列
    • 如何使用iTunes软件通过抓包下载旧版本的ios的app
天高任鸟飞
Oracle/MySQL数据库恢复/数据迁移/生产规范报告技术交流:TEL:18562510581(微信同号);加微信入群
  1. 首页
  2. Oracle
  3. 工厂数据导入导出系列
  4. 正文

ORACLE数据库导入导出——NC

2020年5月16日 1425点热度 0人点赞 0条评论

目录

  • exp导出审查
  • 一、NC脚本创建: 
    • 1、表空间
    • 2、用户:
    • 3、给用户授权sys权限
      • (1)、YCZBWZ授予sys权限
      • (2)、YCZBNZ授予sys权限:
    • 4、创建dmp路径
    • 5、导入,导出命令
    • 6、删除表空间(包含数据文件),用户
    • 7、存在的问题:
      • (1)、角色问题
        • a、创建角色 
        • b、给角色分配权限 
        • c、创建用户:
        • d、把角色赋予指定账户 
        • e、删除角色 
        • f、检查角色的权限 
      • (2)视图问题:
      • (3)用户问题:

exp导出审查

[oracle@*TWE~]$exp ****/****#EDC file='/home/BACKUP/exp_NC/20210129.exp' log='/home/BACKUP/exp_NC/20210129.log' compress=y statistics=none

一、NC脚本创建: 

1、表空间

sql> CREATE tablespace NNC_DATA01 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_DATA01_1.dbf' size 10240m autoextend on next 1000m ;
sql> ALTER  tablespace NNC_DATA01   ADD   DATAFILE'/home/oracle/app/oradata/orcl/NNC_DATA01_2.dbf' size 10240m autoextend on next 1000m ;
sql> CREATE tablespace NNC_DATA02 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_DATA02.dbf' size 10240m autoextend on next 1000m ;
sql> CREATE tablespace NNC_DATA03 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_DATA03.dbf' size 10240m autoextend on next 1000m  ;
sql> CREATE tablespace NNC_INDEX01 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_INDEX01.dbf' size 10240m autoextend on next 1000m ;
sql> CREATE tablespace NNC_INDEX02 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_INDEX02.dbf' size 10240m autoextend on next 1000m ;
sql> CREATE tablespace NNC_INDEX03 logging DATAFILE'/home/oracle/app/oradata/orcl/NNC_INDEX03.dbf' size 10240m autoextend on next 1000m ;

2、用户:

create tablespace NNC_DATA01 datafile '/home/oracle/app/oradata/orcl/NNC_DATA01.DBF' size 10000M autoextend on next 1000M maxsize unlimited logging extent management local autoallocate segment space management auto;
create user YCZBNZ identified by "******" default tablespace NNC_DATA01 temporary tablespace TEMP profile DEFAULT;
create user YCZBWZ identified by "****" default tablespace NNC_DATA01 temporary tablespace TEMP profile DEFAULT;
grant connect,dba,resource to YCZBNZ;
grant connect,dba,resource to YCZBWZ ;

3、给用户授权sys权限

授予用户sys权限(有些角色,或者视图,本用户是没有权限的,可能是有sys创建的,所以需要加上,导入时此不报错)

(1)、YCZBWZ授予sys权限

 grant execute on SYS.DBMS_ALERT to YCZBWZ;
 grant execute on SYS.DBMS_AQ to YCZBWZ with grant option;
 grant execute on SYS.DBMS_AQADM to YCZBWZ with grant option;
 grant execute on SYS.DBMS_AQELM to YCZBWZ with grant option;
 grant execute on SYS.DBMS_AQ_IMPORT_INTERNAL to YCZBWZ with grant option;
 grant execute on SYS.DBMS_DEFER_IMPORT_INTERNAL to YCZBWZ;
 grant execute on SYS.DBMS_REPCAT to YCZBWZ;
 grant execute on SYS.DBMS_RULE_EXIMP to YCZBWZ with grant option;
 grant execute on SYS.DBMS_SQL to YCZBWZ;
 grant execute on SYS.DBMS_SYS_ERROR to YCZBWZ;
 grant execute on SYS.DBMS_SYS_SQL to YCZBWZ;
 grant execute on SYS.DBMS_TRANSFORM_EXIMP to YCZBWZ with grant option;
 grant select, insert, update, delete, references, alter, index on SYS.INCEXP to YCZBWZ;
 grant select, insert, update, delete, references, alter, index on SYS.INCFIL to YCZBWZ;
 grant select, insert, update, delete, references, alter, index on SYS.INCVID to YCZBWZ;
 grant select on WMSYS.WM$UDTRIG_INFO to YCZBWZ;
 grant aq_administrator_role to YCZBWZ with admin option;
 grant dba to YCZBWZ with admin option;
 grant unlimited tablespace to YCZBWZ with admin option;

(2)、YCZBNZ授予sys权限:

 grant execute on SYS.DBMS_ALERT to YCZBNZ;
 grant execute on SYS.DBMS_AQ to YCZBNZ with grant option;
 grant execute on SYS.DBMS_AQADM to YCZBNZ with grant option;
 grant execute on SYS.DBMS_AQELM to YCZBNZ with grant option;
 grant execute on SYS.DBMS_AQ_IMPORT_INTERNAL to YCZBNZ with grant option;
 grant execute on SYS.DBMS_DEFER_IMPORT_INTERNAL to YCZBNZ;
 grant execute on SYS.DBMS_REPCAT to YCZBNZ;
 grant execute on SYS.DBMS_RULE_EXIMP to YCZBNZ with grant option;
 grant execute on SYS.DBMS_SQL to YCZBNZ;
 grant execute on SYS.DBMS_SYS_ERROR to YCZBNZ;
 grant execute on SYS.DBMS_SYS_SQL to YCZBNZ;
 grant execute on SYS.DBMS_TRANSFORM_EXIMP to YCZBNZ with grant option;
 grant select, insert, update, delete, references, alter, index on SYS.INCEXP to YCZBNZ;
 grant select, insert, update, delete, references, alter, index on SYS.INCFIL to YCZBNZ;
 grant select, insert, update, delete, references, alter, index on SYS.INCVID to YCZBNZ;
 grant select on WMSYS.WM$UDTRIG_INFO to YCZBNZ;
 grant aq_administrator_role to YCZBNZ with admin option;
 grant dba to YCZBNZ with admin option;
 grant unlimited tablespace to YCZBNZ with admin option;

4、创建dmp路径

 create directory backup_NCP as '/home/BACKUP/backup_NCP';
 GRANT READ,WRITE ON DIRECTORY backup_NCP to YCZBNZ; 
 GRANT READ,WRITE ON DIRECTORY backup_NCP to YCZBWZ; 

5、导入,导出命令

 expdp yczbnz/Yczbjtnz1qaz#EDC@127.0.0.1/orcl DIRECTORY=backup_NCP DUMPFILE=YCZBNZ-20181016.dmpdp  logfile=YCZBNZ-20181016_dmpdp.log
 expdp yczbnz/Yczbjtnz1qaz#EDC@127.0.0.1/orcl DIRECTORY=backup_NCP DUMPFILE=YCZBNZ-20181016.dmpdp  logfile=YCZBNZ-20181016_dmpdp.log
 impdp yczbnz/Yczbjtnz1qaz#EDC@127.0.0.1/orcl    DIRECTORY=backup_NCP DUMPFILE=YCZBNZ-20181016.dmpdp  logfile=YCZBNZ-20181016_dmpdp.log
 impdp yczbwz/yczb1qaz#EDC@127.0.0.1/orcl    DIRECTORY=backup_NCP DUMPFILE=YCZBWZ-20181016.dmpdp  logfile=YCZBWZ-20181016_dmpdp.log

  如果不好用,可以直接sys导

 impdp sys/oraclehdsoft@orcl directory=backup_NCP dumpfile=YCZBNZ-20181016.dmpdp REMAP_SCHEMA=YCZBNZ:YCZBNZ
 impdp sys/oraclehdsoft@orcl directory=backup_NCP dumpfile=YCZBWZ-20181016.dmpdp REMAP_SCHEMA=YCZBWZ:YCZBWZ

6、删除表空间(包含数据文件),用户

 drop tablespace NNC_DATA01 including contents and datafiles

drop user YCZBNZ cascade;

7、存在的问题:

(1)、角色问题

因为用sys创建的select_role,导入时,用的是yczbnz,所以导入失败,手动执行即可:

ORA-01919: role 'SELECT_ROLE' does not exist  

Failing sql is: GRANT "SELECT_ROLE" TO "YCZBNZ" WITH ADMIN OPTION

a、创建角色 

CREATE ROLE SELECT_ROLE; 

b、给角色分配权限 

grant SELECT ANY DICTIONARY to SELECT_ROLE; 
grant SELECT ANY TABLE to SELECT_ROLE; 
grant SELECT ANY TRANSACTION to SELECT_ROLE; 
grant SELECT ANY SEQUENCE to SELECT_ROLE; 

c、创建用户:

create user BigData_Select_NC identified by NCSelectRole;
grant connect,resource to BigData_Select_NC;


d、把角色赋予指定账户 

grant SELECT_ROLE to BigData_Select_NC; 

e、删除角色 

drop role SELECT_ROLE;

f、检查角色的权限 

select * from dba_sys_privs where grantee='SELECT_ROLE'

(2)视图问题:

ORA-39082: Object type VIEW:"YCZBNZ"."V_XX_IDCONTWZPK" created with compilation warnings

解决:没有自动导入,手动创建即可 

(1)create  or  replace  view  V_XX_IDCONTWZPK as  select  distinct pk_docid ,billpk from    xx_idcontrastpk@dblink_wzdb  where  billtype='gl'  and  nvl(dr,0)=0
(2)create  or  replace  view v_xx_idcontwzpk as select  distinct substr(pk_docid,-20,20)  pk_docid ,billpk from    xx_idcontrastpk@dblink_wzdb  where  billtype='gl'  and  nvl(dr,0)=0

(3)用户问题:

YCZBNZ已经存在:不影响

ORA-31684: Object type USER:"YCZBNZ" already exists

 

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2021年11月25日

admin

这个人很懒,什么都没留下

打赏 点赞
下一篇 >

文章评论

您需要 登录 之后才可以评论

COPYRIGHT © 2022 拓扑园. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

鲁ICP备2021020523号

鲁ICP备2021020523号