목차
Applies to:
Goal
Solution
References
데이터 베이스 MySQL 튜토리얼 如何用sys as sysdba权限连接数据库进行Exp/Imp

如何用sys as sysdba权限连接数据库进行Exp/Imp

Jun 07, 2016 pm 03:47 PM
exp sys 데이터 베이스 권한 지휘하다 연결하다

如何用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

如何用sys as sysdba权限连接数据库进行Exp/Imp

如果你在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进行导出和导入相关的内容的介绍,望你会有所收获。

【编辑推荐】

  1. 3月第4周要闻回顾:Chrome续写传奇 Oracle舍我其谁
  2. Oracle宣布GlassFish路线图 定位为“部门内部”使用
  3. Oracle优化CPU使用的实际操作方案详解
  4. Oracle Spatial 与 ArcSDE在实际应用中的区别
  5. 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     百度


본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

한 번의 클릭으로 루트 권한 활성화(빠른 루트 권한 획득) 한 번의 클릭으로 루트 권한 활성화(빠른 루트 권한 획득) Jun 02, 2024 pm 05:32 PM

이를 통해 사용자는 시스템에 대한 보다 심층적인 작업과 사용자 정의를 수행할 수 있습니다. 루트 권한은 Android 시스템의 관리자 권한입니다. 루트 권한을 얻으려면 일반적으로 일련의 지루한 단계가 필요하지만 일반 사용자에게는 친숙하지 않을 수 있습니다. 한 번의 클릭으로 루트 권한을 활성화함으로써 이 기사에서는 사용자가 시스템 권한을 쉽게 얻을 수 있는 간단하고 효과적인 방법을 소개합니다. 루트 권한의 중요성과 위험을 이해하고 더 큰 자유를 누리십시오. 루트 권한을 통해 사용자는 휴대폰 시스템을 완전히 제어할 수 있습니다. 보안 제어를 강화하고, 테마를 사용자 정의하며, 사용자는 사전 설치된 애플리케이션을 삭제할 수 있습니다. 예를 들어 실수로 시스템 파일을 삭제하여 시스템 충돌을 일으키는 경우, 루트 권한을 과도하게 사용하는 경우, 실수로 악성 코드를 설치하는 경우도 위험합니다. 루트 권한을 사용하기 전에

iOS 18에는 손실되거나 손상된 사진을 검색할 수 있는 새로운 '복구된' 앨범 기능이 추가되었습니다. iOS 18에는 손실되거나 손상된 사진을 검색할 수 있는 새로운 '복구된' 앨범 기능이 추가되었습니다. Jul 18, 2024 am 05:48 AM

Apple의 최신 iOS18, iPadOS18 및 macOS Sequoia 시스템 릴리스에는 사진 애플리케이션에 중요한 기능이 추가되었습니다. 이 기능은 사용자가 다양한 이유로 손실되거나 손상된 사진과 비디오를 쉽게 복구할 수 있도록 설계되었습니다. 새로운 기능에는 사진 앱의 도구 섹션에 '복구됨'이라는 앨범이 도입되었습니다. 이 앨범은 사용자가 기기에 사진 라이브러리에 포함되지 않은 사진이나 비디오를 가지고 있을 때 자동으로 나타납니다. "복구된" 앨범의 출현은 데이터베이스 손상으로 인해 손실된 사진과 비디오, 사진 라이브러리에 올바르게 저장되지 않은 카메라 응용 프로그램 또는 사진 라이브러리를 관리하는 타사 응용 프로그램에 대한 솔루션을 제공합니다. 사용자는 몇 가지 간단한 단계만 거치면 됩니다.

Hibernate는 어떻게 다형성 매핑을 구현합니까? Hibernate는 어떻게 다형성 매핑을 구현합니까? Apr 17, 2024 pm 12:09 PM

Hibernate 다형성 매핑은 상속된 클래스를 데이터베이스에 매핑할 수 있으며 다음 매핑 유형을 제공합니다. Join-subclass: 상위 클래스의 모든 열을 포함하여 하위 클래스에 대한 별도의 테이블을 생성합니다. 클래스별 테이블: 하위 클래스별 열만 포함하는 하위 클래스에 대한 별도의 테이블을 만듭니다. Union-subclass: Joined-subclass와 유사하지만 상위 클래스 테이블이 모든 하위 클래스 열을 통합합니다.

PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 Jun 04, 2024 pm 01:42 PM

MySQLi를 사용하여 PHP에서 데이터베이스 연결을 설정하는 방법: MySQLi 확장 포함(require_once) 연결 함수 생성(functionconnect_to_db) 연결 함수 호출($conn=connect_to_db()) 쿼리 실행($result=$conn->query()) 닫기 연결( $conn->close())

PHP에서 데이터베이스 연결 오류를 처리하는 방법 PHP에서 데이터베이스 연결 오류를 처리하는 방법 Jun 05, 2024 pm 02:16 PM

PHP에서 데이터베이스 연결 오류를 처리하려면 다음 단계를 사용할 수 있습니다. mysqli_connect_errno()를 사용하여 오류 코드를 얻습니다. 오류 메시지를 얻으려면 mysqli_connect_error()를 사용하십시오. 이러한 오류 메시지를 캡처하고 기록하면 데이터베이스 연결 문제를 쉽게 식별하고 해결할 수 있어 애플리케이션이 원활하게 실행될 수 있습니다.

HTML이 데이터베이스를 읽는 방법에 대한 심층 분석 HTML이 데이터베이스를 읽는 방법에 대한 심층 분석 Apr 09, 2024 pm 12:36 PM

HTML은 데이터베이스를 직접 읽을 수 없지만 JavaScript 및 AJAX를 통해 읽을 수 있습니다. 단계에는 데이터베이스 연결 설정, 쿼리 보내기, 응답 처리 및 페이지 업데이트가 포함됩니다. 이 기사에서는 JavaScript, AJAX 및 PHP를 사용하여 MySQL 데이터베이스에서 데이터를 읽는 실제 예제를 제공하고 쿼리 결과를 HTML 페이지에 동적으로 표시하는 방법을 보여줍니다. 이 예제에서는 XMLHttpRequest를 사용하여 데이터베이스 연결을 설정하고 쿼리를 보내고 응답을 처리함으로써 페이지 요소에 데이터를 채우고 데이터베이스를 읽는 HTML 기능을 실현합니다.

Golang을 사용하여 원격 데이터베이스에 연결하는 방법은 무엇입니까? Golang을 사용하여 원격 데이터베이스에 연결하는 방법은 무엇입니까? Jun 01, 2024 pm 08:31 PM

Go 표준 라이브러리 데이터베이스/sql 패키지를 통해 MySQL, PostgreSQL 또는 SQLite와 같은 원격 데이터베이스에 연결할 수 있습니다. 데이터베이스 연결 정보가 포함된 연결 문자열을 생성합니다. sql.Open() 함수를 사용하여 데이터베이스 연결을 엽니다. SQL 쿼리 및 삽입 작업과 같은 데이터베이스 작업을 수행합니다. 리소스를 해제하기 위해 defer를 사용하여 데이터베이스 연결을 닫습니다.

Golang에서 데이터베이스 콜백 함수를 사용하는 방법은 무엇입니까? Golang에서 데이터베이스 콜백 함수를 사용하는 방법은 무엇입니까? Jun 03, 2024 pm 02:20 PM

Golang의 데이터베이스 콜백 기능을 사용하면 다음을 달성할 수 있습니다. 지정된 데이터베이스 작업이 완료된 후 사용자 정의 코드를 실행합니다. 추가 코드를 작성하지 않고도 별도의 함수를 통해 사용자 정의 동작을 추가할 수 있습니다. 삽입, 업데이트, 삭제, 쿼리 작업에 콜백 함수를 사용할 수 있습니다. 콜백 함수를 사용하려면 sql.Exec, sql.QueryRow, sql.Query 함수를 사용해야 합니다.

See all articles