使用bat文件导出oracle数据库转储文件

时间:2013-08-13 09:19:41

标签: oracle oracle11g oracle10g

你能告诉我有没有办法使用这个bat文件制作转储文件[不与我合作] 我尝试发送用户名和密码和sid [tns别名]但不起作用 我在tnsnames.ora中的连接看起来像

testDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ara-server)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = xe)
    )
  )

我的bat文件看起来像

cls
@echo off
REM Export Full database with auto filename for dump and log
REM This batch file will create the dump and log files in the same directory as of batch
REM File name syntax --> <SCHEMANAME>_<DD>_<MM>_<YYYY>
REM Auther: Deepu Mohan P, www.deepumohan.com
REM Created:  07-Sep-2009
REM Modified: 30-Sep-2009, 01-Oct-2009

REM Get user credentials
set /p schema=Enter username:
set /p pwd=Enter password:
set /p sid=SID:

REM Following block is for getting the year, month and day
REM ======================================================
   FOR /f "tokens=2-4 skip=1 delims=(-)" %%G IN ('echo.^|date') DO (
      FOR /f "tokens=2 delims= " %%A IN ('date /t') DO (
         SET v_first=%%G
         SET v_second=%%H
         SET v_third=%%I
         SET v_all=%%A
      )
   )

      SET %v_first%=%v_all:~0,2%
      SET %v_second%=%v_all:~3,2%
      SET %v_third%=%v_all:~6,4%
REM =====================================================

exp %schema%/%pwd%@%sid% FILE=''%user%_%dd%_%mm%_%yy%.dmp log=%user%_%dd%_%mm%_%yy%.log
compress=N rows=Y grants=Y buffer=500000 FULL=Y statistics=NONE

pause

显示错误: -

EXP-00056:遇到ORACLE错误12154 ORA-12154:TNS:无法解析指定的连接标识符 EXP-00000:导出终止失败 'compress'不被识别为内部或外部命令, 可操作程序或批处理文件。

注意我尝试在第二次将sid参数设置为testDB或xe但不起作用

0 个答案:

没有答案