oracle - “如何在不执行 impdp 的情况下恢复 EXPDP 后删除的架构?
问题描述
我正在为即将到来的项目演奏——如何演奏expdp
和impdp
在距离测试环境两个级别的游戏环境中。所以我expdp
使用 scott/tiger 并导出了 scott 模式。但是,出于好奇,我从数据库中删除了 Scott 模式(希望impdp
在同一个数据库中进行),然后我遇到了很多错误并从数据库中丢失了 Scott 模式。
我是否可以从转储文件中恢复 Scott 架构?
这就是我所做的:
expdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=expdpscott.log
impdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=impdpscott.log
. . . 然后我得到了这个:作业“SCOTT”。“SYS_IMPORT_SCHEMA_01”在 19:13:31 完成,出现 4 个错误”
...然后我做了:
drop user Scott cascade;
接着
impdp scott/tiger schemas=scott directory=test_dir dumpfile=scott.dmp logfile=impdpscott.log
然后我收到了这个错误:
UDI-01017:操作生成 ORACLE 错误 1017 ORA-01017:用户名/密码无效;登录被拒绝
......现在我意识到我做了一件愚蠢的事情(这对学习者来说很好)。
如何取回或恢复已删除的scott
架构?
解决方案
如果您发布了您在第 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
再次运行。
推荐阅读
- go - Imaginary 在高负载时感到恐慌
- apache-kafka - 是否可以在 osquery 代理上配置 Kafka SASL 身份验证?
- javascript - 无法触发 WebRTC 跟踪事件
- javascript - Firebase Cloud Storage:资源:服务器响应状态为 403 ()
- xamarin.forms - Xamarin FreshMVVM - 选项卡式导航 ViewIsAppearing 方法未在初始选项卡单击时触发
- android - 文本数据绑定在 Retrofit2 回调中不起作用
- python - 将熊猫数据框中的对象数据类型动态转换为分类的最佳实践
- javascript - 不间断地播放多个 HTML 视频
- tensorflow-datasets - 关于 tf.repeat().batch(batch_size)
- windows - 我可以更改已构建库中隐式链接的 DLL 的名称吗?