首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否可以转储Oracle数据库以在另一台计算机上重建它?

是否可以转储Oracle数据库以在另一台计算机上重建它?
EN

Stack Overflow用户
提问于 2020-05-14 22:34:30
回答 2查看 65关注 0票数 1

正如标题所问的,我有一个完整的oracle Xe11g数据库,我必须在我的老师的机器上导出它才能“显示”它,我在互联网上看到了一些数据库转储的例子,但我不太理解这个过程,如果一个数据库转储可以用相同的oracle Xe11g重新构建到另一台机器上,有人能给我解释一下吗?我保留了原始的sql查询文件,但这些文件有点凌乱。

EN

回答 2

Stack Overflow用户

发布于 2020-05-15 03:02:51

由于它是11gXE,一个简单的选项是使用(原始的) exportimport实用程序。为什么不是data pump?这两个更简单,可以完成这项工作。

下面是一个示例:在XE数据库中,我有一个名为mike的用户,它将“表现”为您的用户。

代码语言:javascript
复制
c:\Temp>exp system/pwd owner=mike file=mike.dmp log=mike_exp.log

Export: Release 11.2.0.2.0 - Production on ╚et Svi 14 20:56:52 2020

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Export done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user MIKE
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user MIKE
About to export MIKE's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export MIKE's tables via Conventional Path ...
. . exporting table                           TEST          0 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.

c:\Temp>

现在我将删除它,这样我的数据库就不再有mike,它将“表现”得好像它是您老师的XE数据库一样。你--或者你的老师--不会这么做。

代码语言:javascript
复制
c:\Temp>sqlplus sys/pwd as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on ╚et Svi 14 20:29:28 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> drop user mike cascade;

User dropped.

SQL>

现在,您可以将mike.dmp文件放入U盘(如果文件不太大,也可以将其邮寄给您的老师)。教师首先必须创建用户mike,然后导入您的mike.dmp文件。

你的老师会这样做:

代码语言:javascript
复制
c:\Temp>sqlplus sys/pwd as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on ╚et Svi 14 20:50:20 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS

SQL> create user mike identified by lion
  2  default tablespace users
  3  temporary tablespace temp
  4  quota unlimited on users;

User created.

SQL> grant create session to mike;

Grant succeeded.

SQL>

导入:

代码语言:javascript
复制
c:\Temp>imp system/pwd file=mike.dmp full=y log=mike_imp.log

Import: Release 11.2.0.2.0 - Production on ╚et Svi 14 21:00:04 2020

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

Export file created by EXPORT:V11.02.00 via conventional path
import done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing SYSTEM's objects into SYSTEM
. importing MIKE's objects into MIKE
. . importing table                         "TEST"          0 rows imported
Import terminated successfully without warnings.

c:\Temp>

就是这样;老师如何将你的模式放在他们的数据库中,他们可以作为mike连接并检查你所做的一切。

票数 2
EN

Stack Overflow用户

发布于 2020-05-14 23:24:26

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61800038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档