如何用sys as sysdba权限连接数据库进行Exp/Imp
如何用sys as sysdba权限连接数据库进行Exp/Imp Windows: exp 'sys/change_on_install@instance as sysdba' tables=scott.emp Unix or Linux (you need to 'escape' the single quote): exp /'sys/change_on_install@instance as sysdba/' tables=scott.emp
如何用sys as sysdba权限连接数据库进行Exp/Imp
Windows:
exp 'sys/change_on_install@instance as sysdba' tables=scott.emp
Unix or Linux (you need to 'escape' the single quote):
exp /'sys/change_on_install@instance as sysdba/' tables=scott.emp
VMS (use [double_quote][single_quote]...[single_quote][double_quote]):
exp "'sys/change_on_install@instance as sysdba'" tables=scott.emp
小结:
1、USERID 必须是命令行中的第一个参数。(如imp help=y里显示的内容)所以如exp ‘ as sysdba’等价于exp USERID=‘as sysdba’,即可以省略USERID不写。
2、imp/exp命令里参数与参数间的间隔是用空格来区分的(等号两边的空格不算),于是像如下语句:exp USERID= sys/123456 as sysdba就不能被imp/exp工具所理解(参数USERID= sys/123456可以解析出来,但是as sysdba不知道如何理解了,as或sysdba又不属于设定的参数名)。而oracle公司设计的软件里一般用单引号将一字符串常量包括起来。将上面语句改为exp USERID= ’sys/123456 as sysdba‘的话,imp/exp工具就认为sys/123456 as sysdba整体是一个字符串,故而就是参数USERID的一个值。
3.
如果是写在参数文件中,则连接字符串需要用双引号了:
USERID=" as sysdba"
Parameter file.
You can also specify the username in the parameter file. In this situation, you have to enclose the connect string with a double quote character. However, to prevent possible security breaches we advice you to stop using the USERID parameter in a parameter file.
Contents of file exp.par:
USERID="sys/change_on_install@instance as sysdba"
TABLES=scott.emp
Run export with:
exp parfile=exp.par
注释:imp/exp(
impdp/expdp
)默认目录是什么,即parfile=exp.par里的文件exp.par在什么目录下?附加:
impdp/expdp
)默认目录是什么(5)、数据泵如何决定文件的路径
5.1 如果目录对象是文件标示符的一部分,那么目录对象指定的路径就需要使用。在目录MY_DIR创建dump文件的示例:
> expdp scott/tiger DUMPFILE=my_dir:expdp_s.dmp NOLOGFILE=Y
5.2 如果目录对象不代表一个文件,那么就需要使用DIRECTORY变量命名的目录对象。目录MY_DIR中创建dump文件,目录MY_DIR_LOG中创建日志文件的示例:
> expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp \
LOGFILE=my_logdir:expdp_s.log
5.3 如果没有明确目录对象,也没有以DIRECTORY变量命名的目录对象,那么环境变量DATA_PUMP_DIR将会使用。环境变量是在在运行导出和导入数据泵应用的客户端系统中使用操作系统命令定义的,分配给基于客户端环境变量的取值必须和基于服务端的目录对象一致,且必须首先在服务器端建立。
目录MY_DIR中创建dump文件和MY_DIR_LOG中创建日志文件的示例:
在使用expdp的客户端机器上,设定环境变量:
-- On windows, place all expdp parameters on one single line:
C:\> set DATA_PUMP_DIR=MY_DIR
C:\> expdp scott/tiger@my_db_alias DUMPFILE=expdp_s.dmp
LOGFILE=my_logdir:expdp_s.log
注意环境变量DATA_DUMP_DIR对应的目录名称是大小写敏感的。设定错误的DATA_PUMP_DIR环境变量会报错,例如:DATA_PUMP_DIR=My_Dir:
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name My_Dir is invalid
5.4 如果之前三种情况都没有创建目录对象,作为一个具有权限的用户(例如具有EXP_FULL_DATABASE或IMP_FULL_DATABASE角色),那么数据泵试图使用默认的基于服务器端的目录对象,DATA_PUMP_DIR。理解数据泵不会创建DATA_PUMP_DIR目录对象是非常重要的。仅当授权用户未使用任何之前提到的机制创建的目录对象时,才会尝试使用DATA_PUMP_DIR。这个默认的目录对象必须首先由DBA创建。不要将这个和同名的基于客户端的环境变量相混淆。
首先,清空DATA_PUMP_DIR环境变量:
C:\> set DATA_PUMP_DIR=
创建DATA_PUMP_DIR的目录:
CONNECT SYSTEM/MANAGER
CREATE OR REPLACE DIRECTORY data_pump_dir AS 'D:\DataPump';
GRANT read, write ON DIRECTORY data_pump_dir TO scott;
-- On windows, place all expdp parameters on one single line:
C:\> expdp system/manager@my_db_alias DUMPFILE=expdp_s.dmp
LOGFILE=expdp_s.log SCHEMAS=scott
如果SCOTT用户不是授权用户,不能使用默认的DATA_PUMP_DIR。
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39145: directory object parameter must be specified and non-null
用户SCOTT的解决方法:如上面5.3,SCOTT可以设置环境变量DATA_PUMP_DIR为MY_DIR:
-- On windows, place all expdp parameters on one single line:
C:\> set DATA_PUMP_DIR=MY_DIR
C:\> expdp scott/tiger@my_db_alias DUMPFILE=expdp_s.dmp
LOGFILE=expdp_s.log SCHEMAS=scott
或者这种特定场景下,用户SCOTT也可以有目录DATA_PUMP_DIR的读和写权限:
-- On windows, place all expdp parameters on one single line:C:\> set DATA_PUMP_DIR=DATA_PUMP_DIR
C:\> expdp scott/tiger@my_db_alias DUMPFILE=expdp_s.dmp
LOGFILE=expdp_s.log SCHEMAS=scott
参考:http://blog.csdn.net/bisal/article/details/24667609
=============================================
Oracle exp备份使用sysdba进行导出和导入的操作
2010-03-29 16:16 佚名 博客园 字号:T | T
如果你在Oracle exp备份的实际应用方面,你是否存在一些不解之处,以下的文章主要是通过对Oracle exp备份的实际应用的。 方案的介绍,来解答你在@@@@@@在实际操作方面的问题。
AD:51CTO学院:IT精品课程在线看!
我们在一些相关的书籍或是网上的相关资料对Oracle exp备份(导出/导入备份)使用sysdba进行导出和导入的实际操作步骤都有相关的介绍,以下的文章就对Oracle exp备份的实际操作步骤的本人的idea。
1. 命令行方式:
A: Windows平台:
C:
<ol><li><span><span>\</span><span>></span><span> exp<span><strong> ‘</strong></span>as sysdba' </span><span>tables</span><span>=</span><span>scott</span><span>.emp </span><span>file</span><span>=e:\emp.dmp </span></span></li></ol>
B: Unix & Linux平台(这时的"'"需要用到转义字符"\"):
<ol><li><span><span>$ exp \'sys/change_on_install@instance as sysdba\<br>' </span><span>tables</span><span>=</span><span>scott</span><span>.emp </span><span>file</span><span>=/home/oracle/emp.dmp </span></span></li></ol>
C:Oracle exp备份(导出/导入备份)使用sysdba进行导出和导入时。你需要在表空间导入和导出
<ol> <li><span><span>$ imp \'usr/pwd@instance as sysdba\'<br> </span><span>tablespaces</span><span>=</span><span>xx</span><span> </span><span>transport_tablespace</span><span>=</span><span>y</span><span> </span></span></li> <li> <span>file</span><span>=</span><span>xxx</span><span>.dmp </span><span>datafiles</span><span>=</span><span>xxx</span><span>.dbf </span> </li> </ol>
2. 交互输入方式: exp tables=scott.emp --不输入连接字符串,直接回车
<ol><li><span><span>Export: Release 10.2.0.3.0 - Production on Fri<br> Jun 25 07:39:46 2004 Copyright (c) 1982, 2005,<br> Oracle. All rights reserved. </span></span></li></ol>
Username: as sysdba --输入连接字符串.
3.如果是写在参数文件中,则连接字符串需要用双引号了:
<ol><li><span><span><span>USERID</span><span>=</span><span>" as sysdba"</span><span> </span></span></span></li></ol>
以上就是对Oracle exp备份(导出/导入备份)使用sysdba进行导出和导入相关的内容的介绍,望你会有所收获。
【编辑推荐】
- 3月第4周要闻回顾:Chrome续写传奇 Oracle舍我其谁
- Oracle宣布GlassFish路线图 定位为“部门内部”使用
- Oracle优化CPU使用的实际操作方案详解
- Oracle Spatial 与 ArcSDE在实际应用中的区别
- Oracle Spatial在实际应用中的六大功能体现
============================================================
如何用sys as sysdba权限连接数据库进行EXP/IMP 2008-07-01 08:55:36
分类: Oracle
使用sys as sysdba权限进行EXP/IMP与其它用户稍有不同,详细内容如下(摘自metalink)
Applies to:
Oracle Server - Enterprise Edition - Version: 8.1.7.0 to 10.2.0.0
Oracle Server - Personal Edition - Version: 8.1.7.0 to 10.2.0.0
Oracle Server - Standard Edition - Version: 8.1.7.0 to 10.2.0.0
Information in this document applies to any platform.
Goal
This document demonstrates how to connect AS SYSDBA when starting an export or import.
Incorrect usage of single or double quotes can result in errors such as:
LRM-00108: invalid positional parameter value 'as'
EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
EXP-00000: Export terminated unsuccessfully
Or:
LRM-00108: invalid positional parameter value 'sysdba'
Or:
LRM-00108: Message 108 not found; No message file for product=ORACORE, facility=LRM
Solution
SYSDBA is used internally in the Oracle database and has specialized functions. Its behavior is not the same as for generalized users. For example, the SYS user cannot do a transaction level consisent
read (read-only transaction). Queries by SYS will return changes made during the transaction even if SYS has set the transaction to be READ ONLY. Therefore export parameters like CONSISTENT, OBJECT_CONSISTENT, FLASHBACK_SCN, and FLASHBACK_TIME cannot be used.
Starting with Oracle10g, the export shows a warning that the export is not consistent when the export is started with CONSISTENT=Y and connects to the database with the user SYS (or as SYSDBA):
EXP-00105: parameter CONSISTENT is not supported for this user
Note that Oracle automatically provides read consistency to a query so that all the data that the query sees comes from a single point in time (statement-level read consistency). For export this means that the export of table data is consistent. However, if a table contains nested tables, the outer table and each inner table are exported as separate transactions. And if a table is partitioned, each partition is exported as a separate transaction. If a nested table or a partitioned table was updated during the export, the data that is exported while connected as the SYS schema could be inconsistent.
Typically, there is no need to invoke Export or Import as SYSDBA, except in the following situations:
- at the request of Oracle technical support;
- when exporting a transportable tablespace set with the old-style export utility (Oracle9i and Oracle8i);
- when importing a transportable tablespace set with the old-style import utility (Oracle10g, Oracle9i, and Oracle8i).
The examples below are based on:
- the export of table emp, owned by the demo schema scott.
- schema SYS with the password: change_on_install.
- alias 'instance' that is specified in the tnsnames.ora file and used for a connect to the database.
To invoke Export or Import as SYSDBA, use the following syntax (this syntax is similar when invoking import and the syntax has not changed with the new Oracle10g Export DataPump and Import DataPump utilities):
1. Command line.
Enclose the connect string with a single quote character:
Windows:
exp 'sys/change_on_install@instance as sysdba' tables=scott.emp
Unix (you need to 'escape' the single quote):
exp \'sys/change_on_install@instance as sysdba\' tables=scott.emp
VMS (use [double_quote][single_quote]...[single_quote][double_quote]):
exp "'sys/change_on_install@instance as sysdba'" tables=scott.emp
Note that this VMS syntax is also a valid syntax on Unix and on Windows.
2. Interactive
Do not specify any connect string on the command line, so you will be prompted to enter it. E.g.:
% exp tables=scott.emp
Export: Release 10.1.0.2.0 - Production on Fri Jun 25 07:39:46 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Username: sys/change_on_install@instance as sysdba
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
... etc.
3. Parameter file.
You can also specify the username in the parameter file. In this situation, you have to enclose the connect string with a double quote character. However, to prevent possible security breaches we advice you to stop
using the USERID parameter in a parameter file.
Contents of file exp.par:
USERID="sys/change_on_install@instance as sysdba"
TABLES=scott.emp
Run export with:
exp parfile=exp.par
Remarks:
1. If you have setup operating system authentication, it is not necessary to specify the SYS schema name, and password. E.g: exp "'/@instance as sysdba'" tables=scott.emp
2. In addition, if you have set the environment variable TWO_TASK (on Unix) or LOCAL (on Windows) or on the server where the database is installed you have set ORACLE_HOME and ORACLE_SID, it is not necessary to specify the @instance. E.g: exp "'/ as sysdba'"
tables=scott.emp
3. The export parameters FLASHBACK_SCN and FLASHBACK_TIME cannot be used if the user that invoked the export is connected AS SYSDBA.
4. Known issues:
Bug
1616035 "EXPORT FAILED WITH ORA-1031 WHEN LOGIN AS SYSDBA" (not a public bug; fixed in 8.1.7.3 and higher)
Bug
2936288 "ORA-1925 OCCURS WHEN IMPORTING AS SYS ACCOUNT"
Bug
2996947 "EXP DID NOT RAISE ERROR WHEN SYSDBA EXPORTS WITH CONSISTENT=Y" (not a public bug; fixed in Oracle10g and higher)
References
Bug
2936288 - Ora-1925 Occurs When Importing As Sys Account
Note
112269.1 - How to set Unix env. variable TWO_TASK and Windows NT counterpart, LOCAL
Note
130332.1 - Export / Import Connecting "AS SYSDBA" Fails with LRM-00108 and EXP-00019
Note
204334.1 - Parameters FLASHBACK_SCN And FLASHBACK_TIME: Point In Time Export
Note
228482.1 - Schema's CTXSYS, MDSYS and ORDSYS are Not Exported
Note
277606.1 - How to Prevent EXP-00079 or EXP-00080 Warning (Data in Table xxx is Protected) During Export
参考:exp sysdba 百度

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

可以让用户对系统进行更深入的操作和定制,root权限是一种管理员权限,在Android系统中。获取root权限通常需要一系列繁琐的步骤,对于普通用户来说可能不太友好、然而。通过一键开启root权限,本文将介绍一种简单而有效的方法,帮助用户轻松获取系统权限。了解root权限的重要性及风险拥有更大的自由度,root权限可以让用户完全控制手机系统。加强安全控制等,定制主题、用户可以删除预装应用。比如误删系统文件导致系统崩溃,过度使用root权限也存在风险、不慎安装恶意软件等,然而。在使用root权限前

Go语言是一种高效、简洁且易于学习的编程语言,因其在并发编程和网络编程方面的优势而备受开发者青睐。在实际开发中,数据库操作是不可或缺的一部分,本文将介绍如何使用Go语言实现数据库的增删改查操作。在Go语言中,我们通常使用第三方库来操作数据库,比如常用的sql包、gorm等。这里以sql包为例介绍如何实现数据库的增删改查操作。假设我们使用的是MySQL数据库。

Hibernate多态映射可映射继承类到数据库,提供以下映射类型:joined-subclass:为子类创建单独表,包含父类所有列。table-per-class:为子类创建单独表,仅包含子类特有列。union-subclass:类似joined-subclass,但父类表联合所有子类列。

苹果公司最新发布的iOS18、iPadOS18以及macOSSequoia系统为Photos应用增添了一项重要功能,旨在帮助用户轻松恢复因各种原因丢失或损坏的照片和视频。这项新功能在Photos应用的"工具"部分引入了一个名为"已恢复"的相册,当用户设备中存在未纳入其照片库的图片或视频时,该相册将自动显示。"已恢复"相册的出现为因数据库损坏、相机应用未正确保存至照片库或第三方应用管理照片库时照片和视频丢失提供了解决方案。用户只需简单几步

HTML无法直接读取数据库,但可以通过JavaScript和AJAX实现。其步骤包括建立数据库连接、发送查询、处理响应和更新页面。本文提供了利用JavaScript、AJAX和PHP来从MySQL数据库读取数据的实战示例,展示了如何在HTML页面中动态显示查询结果。该示例使用XMLHttpRequest建立数据库连接,发送查询并处理响应,从而将数据填充到页面元素中,实现了HTML读取数据库的功能。

如何在PHP中使用MySQLi建立数据库连接:包含MySQLi扩展(require_once)创建连接函数(functionconnect_to_db)调用连接函数($conn=connect_to_db())执行查询($result=$conn->query())关闭连接($conn->close())

PHP中处理数据库连接报错,可以使用以下步骤:使用mysqli_connect_errno()获取错误代码。使用mysqli_connect_error()获取错误消息。通过捕获并记录这些错误信息,可以轻松识别并解决数据库连接问题,确保应用程序的顺畅运行。

1、以e盘为例。打开【计算机】,并点击【e盘】右击【属性】。如图所示:2、在【窗口】页面中,将界面切换到【安全】选项,点击下方的【编辑】选项。如图所示:3、在【权限】的选项中,并点击【添加】选项。如图所示:4、弹出用户和组窗口点击【高级】选项。如图所示:5、按序依次点击展开【立即查找】—【everyone】选项,完成后,点击确定。如图所示:6、当看到【e盘权限】页面中的【组或用户中】新增了【everyone】这个用户,选择【everyone】并在【完全控制】前面打钩,设置完成后,按下【确定】即可
