简体   繁体   中英

How to export Oracle database as system user with os authentication?

User oracle is configured with os authentication and logged in as oracle.

I am trying to to take full db export using the following expression:

exp 'system/as sysdba' file='full_exp.dmp' log='full_exp.log' consistent='y'

but getting error:

LRM-00108: Invalid positional parameter value 'sysdba'

Also tried with:

exp 'system' file='full_exp.dmp' log='full_exp.log' consistent='y'

Asks for password for system and empty password doesn't work, throws errors EXP-00004, EXP-00056 and ORA-01017 .

Please guide me in taking full db export by os authenticated user.

Doing a full export "as sysdba" is a bad idea - a major security risk (plus "system" doesn't have the sysdba privilege by default anyway). You are better off defining a user with exp_full_database and/or datapump_exp_full_database privileges only, with OS authentication or with an Oracle Wallet to hold the credentials, and using that account to run the full export.

create user export_user identified by [password];
grant create session, exp_full_database, datapump_exp_full_database to export_user;

There is a reference on my blog on how to set up an Oracle Wallet for the credentials. Then your expdp or exp command would look like this:

exp export_user file='full_exp.dmp' ...

or

expdp export_user directory=export_dir ...

Last - seriously consider using Datapump (expdp) rather than the old-school "export" utility (exp). Newer versions of Oracle include object types that export doesn't support, and Datapump is generally faster and more flexible in terms of options.

To use Oracle OS authentification for a non SYSDBA connection, you just need to connect with the OS account that is mapped to the Oracle account and use / as user/password:

sqlplus /
expdp / ...

See details for Unix and Windows in https://oracle-base.com/articles/misc/os-authentication

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM