【问题标题】:"How to recover a schema dropped after EXPDP without doing the impdp?“如何在不执行 impdp 的情况下恢复 EXPDP 后删除的架构?
【发布时间】:2019-06-25 16:00:27
【问题描述】:

我正在玩 - 对于我即将到来的项目 - 如何在距离测试环境两个级别的游戏环境中执行 expdpimpdp。所以我用 scott/tiger 做了expdp 并导出了 scott 模式。但是,出于好奇,我从数据库中删除了 Scott 模式(希望在同一个数据库中执行 impdp),然后我遇到了很多错误并从数据库中丢失了 Scott 模式。

我是否可以从转储文件中恢复 Scott 架构?

这就是我所做的:

  1. expdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=expdpscott.log

  2. impdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=impdpscott.log . . . 然后我得到了这个:

    作业“SCOTT”。“SYS_IMPORT_SCHEMA_01”在 19:13:31 完成,出现 4 个错误

    ...然后我做了:

  3. drop user Scott cascade;

    然后

  4. impdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=impdpscott.log

然后我得到了这个错误:

UDI-01017:操作生成 ORACLE 错误 1017 ORA-01017:无效 用户名密码;登录被拒绝

...现在我意识到我做了一件愚蠢的事情(这对学习者来说很好)。

如何取回或恢复已删除的 scott 架构?

【问题讨论】:

    标签: oracle schema recovery datapump


    【解决方案1】:

    如果您发布了您在第 2 步中遇到的错误,那就太好了;也许他们无关紧要。

    现在,当您删除 Scott 时,以特权用户(例如 SYS)的身份连接并创建用户 Scott。这是一个例子:

    • 检查数据库中的表空间列表
    • 创建用户
    • 授予它一些权限

    SQL> select tablespace_name from dba_tablespaces;
    
    TABLESPACE_NAME
    ------------------------------
    SYSTEM
    SYSAUX
    UNDOTBS1
    TEMP
    USER_DATA
    APEX
    APEX_9695076087226093
    
    7 rows selected.
    
    SQL> create user littlefoot identified by lion
      2    default tablespace user_data
      3    temporary tablespace temp
      4    profile default
      5    quota  unlimited on user_data;
    
    User created.
    
    SQL>
    SQL> grant create session       to littlefoot;
    
    Grant succeeded.
    
    SQL> grant create table         to littlefoot;
    
    Grant succeeded.
    
    SQL> grant create procedure     to littlefoot;
    
    Grant succeeded.
    
    SQL> grant create sequence      to littlefoot;
    
    Grant succeeded.
    
    SQL> grant create view          to littlefoot;
    
    Grant succeeded.
    
    SQL> grant create trigger       to littlefoot;
    
    Grant succeeded.
    
    SQL>
    

    一旦你这样做了,再次运行IMPDP

    【讨论】:

    • 我按照您在此处放置的步骤得到了这个 ORA-39002:无效操作 ORA-39070:无法打开日志文件。 ORA-39087: 目录名 TEST_DIR 无效
    猜你喜欢
    • 2014-04-05
    • 1970-01-01
    • 2011-11-20
    • 2023-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-27
    • 1970-01-01
    相关资源
    最近更新 更多