DOS option jump implementation, dos + bcp double-click import and export data, bcp Import and Export

Source: Internet
Author: User

DOS option jump implementation, dos + bcp double-click import and export data, bcp Import and Export

DOS option jump implementation, dos + bcp double-click import and export data

  • Option. bat

@echo off:Start2 clsgoto Start:Starttitle Frequently Used Websitesecho Please select a website from the listecho with the corresponding keyecho --------------------------------------echo [1] Googleecho [2] Wikipediaecho [3] Facebookecho [4] Youtubeecho [5] Yahooset input=set /p input= Choice:if "%input%" =="" goto Nif %input%==1 goto Z if NOT goto Start2if %input%==2 goto X if NOT goto Start2if %input%==3 goto C if NOT goto Start2if %input%==4 goto V if NOT goto Start2if %input%==5 goto B if NOT goto Start2if %input% gtr 5 goto N:Zclsecho You have selected Googlepausestart www.google.comexit:Xclsecho You have selected Wikipediapausestart www.wikipedia.comexit:Cclsecho You have selected Facebookpausestart www.facebook.comexit:Vclsecho You have selected Youtubepausestart www.youtube.comexit:Bclsecho You have selected Yahoopausestart www.Yahoo.comexit:Nclsecho Invalid Selection! Try againpausegoto :start2


  • Mantis%225_exportsalesorder_autosys.cmd

@cls@echo OFF@set "endfix=%date:~,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%"@SETLOCAL ENABLEEXTENSIONS@SETLOCAL ENABLEDELAYEDEXPANSION@echo ...@echo VALIDATE ENVIRONMENT VARIABLES ...rem +--------------------------------------------------------------------------+rem | VALIDATE ENVIRONMENT VARIABLES                                           |rem +--------------------------------------------------------------------------+@set MSBACKUP=D:\SalesOrder_NEWDRM@set MSLOG=D:\SalesOrder_NEWDRM@set MSTMP=D:\SalesOrder_NEWDRM@echo ...@echo DECLARE ALL GLOBAL VARIABLES...rem +--------------------------------------------------------------------------+rem | DECLARE ALL GLOBAL VARIABLES.                                            |rem +--------------------------------------------------------------------------+@set FILENAME=SALESORDER@set DB_USERNAME=DRMPOS@set DB_PASSWORD=DRMPOS@set TNS_ALIAS=DRMPROD@set LOGFILE=%MSLOG%\%FILENAME%_%TNS_ALIAS%.log@set DUMPFILE=%MSBACKUP%\%FILENAME%_%TNS_ALIAS%.datrem +--------------------------------------------------------------------------+rem | WRITE EXPORT PARAMETER FILE.                                             |rem +--------------------------------------------------------------------------+@echo ...@echo MOVE OLD EXPORT (DUMP) FILE....rem +--------------------------------------------------------------------------+rem | MOVE OLD EXPORT (DUMP) FILE.                                             |rem +--------------------------------------------------------------------------+@if exist "%DUMPFILE%.backup" (del /q "%DUMPFILE%.backup")@if exist %DUMPFILE% (echo f|@xcopy /y   %DUMPFILE% %DUMPFILE%.backup)@if exist %LOGFILE% (echo f|xcopy /y  %LOGFILE% "%LOGFILE%.%endfix%")@if exist "%LOGFILE%.%endfix%" (echo f | xcopy /y  "%LOGFILE%.%endfix%" D:\SalesOrder_NEWDRM\logfile\&del /q "%LOGFILE%.%endfix%")@if exist %LOGFILE% (del /q %LOGFILE%)@echo ...@echo PERFORM EXPORT...rem +--------------------------------------------------------------------------+rem | PERFORM EXPORT.                                                          |rem +--------------------------------------------------------------------------+rem exp parfile=%PARFILE%@bcp " select * from drmpos.SALESORDER where orderdate >= convert(DATE,getdate()-10)" queryout %DUMPFILE% -T -c -t^| -d apoms -e %LOGFILE%  @IF not EXIST %LOGFILE% GOTO end@echo ...error occured@echo SCAN THE EXPORT LOGFILE FOR ERRORS...rem +--------------------------------------------------------------------------+rem | SCAN THE EXPORT LOGFILE FOR ERRORS.                                      |rem +--------------------------------------------------------------------------+@echo ...@echo Analyzing log file for errors...@findstr /I /C:"Export terminated unsuccessfully" %LOGFILE%@if errorlevel 1 (goto good1) else (goto exception):END@echo ...@echo finished WITHOUT errorlog@exit /b 0:good1@echo ...@echo Analyzing log file for MS-errors...@findstr /I /C:"invalid" %LOGFILE%@if errorlevel 1 (goto good2) else (goto exception):good2@echo ...@echo Analyzing log file for warnings...@findstr /I /C:"error" %LOGFILE%@if errorlevel 1 (goto good3) else (goto exception):good3@echo ...@echo Analyzing log file for warnings...@findstr /I /C:"rows" %LOGFILE%@if errorlevel 1 (cmd /c exit 0) else (goto exception)@exit /b 0:exception@exit /b 1


  • Mantis%227_importsalesorder_autosys.cmd
@cls@echo OFF@set "endfix=%date:~,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%"@SETLOCAL ENABLEEXTENSIONS@SETLOCAL ENABLEDELAYEDEXPANSION@echo ...@echo VALIDATE ENVIRONMENT VARIABLES ...rem +--------------------------------------------------------------------------+rem | VALIDATE ENVIRONMENT VARIABLES                                           |rem +--------------------------------------------------------------------------+@set MSBACKUP=D:\SalesOrder_NEWDRM@set MSLOG=D:\SalesOrder_NEWDRM@set MSTMP=D:\SalesOrder_NEWDRM@echo ...@echo DECLARE ALL GLOBAL VARIABLES...rem +--------------------------------------------------------------------------+rem | DECLARE ALL GLOBAL VARIABLES.                                            |rem +--------------------------------------------------------------------------+@set FILENAME=SALESORDER@set DB_USERNAME=DRMPOS@set DB_PASSWORD=DRMPOS@set TNS_ALIAS=DRMPROD@set LOGFILE=%MSLOG%\IMP_%FILENAME%_%TNS_ALIAS%.log@set DUMPFILE=%MSBACKUP%\%FILENAME%_%TNS_ALIAS%.datrem +--------------------------------------------------------------------------+rem | WRITE EXPORT PARAMETER FILE.                                             |rem +--------------------------------------------------------------------------+@echo ...@echo MOVE OLD EXPORT (DUMP) FILE....rem +--------------------------------------------------------------------------+rem | MOVE OLD EXPORT (DUMP) FILE.                                             |rem +--------------------------------------------------------------------------+@if exist "%DUMPFILE%.backup" (del /q "%DUMPFILE%.backup")@if exist %DUMPFILE% (echo f|@xcopy /y   %DUMPFILE% %DUMPFILE%.backup)@if exist %LOGFILE% (echo f|xcopy /y  %LOGFILE% "%LOGFILE%.%endfix%")@if exist "%LOGFILE%.%endfix%" (echo f | xcopy /y  "%LOGFILE%.%endfix%" D:\SalesOrder_NEWDRM\logfile\&del /q "%LOGFILE%.%endfix%")@if exist %LOGFILE% (del /q %LOGFILE%)@echo ...@echo PERFORM EXPORT...rem +--------------------------------------------------------------------------+rem | PERFORM EXPORT.                                                          |rem +--------------------------------------------------------------------------+rem exp parfile=%PARFILE%@bcp apoms.drmpos.SALESORDER in %DUMPFILE% -T -c -t^|  -e %LOGFILE%  @IF not EXIST %LOGFILE% GOTO end@echo ...error occured@echo SCAN THE EXPORT LOGFILE FOR ERRORS...rem +--------------------------------------------------------------------------+rem | SCAN THE EXPORT LOGFILE FOR ERRORS.                                      |rem +--------------------------------------------------------------------------+@echo ...@echo Analyzing log file for errors...@findstr /I /C:"Export terminated unsuccessfully" %LOGFILE%@if errorlevel 1 (goto good1) else (goto exception):END@echo ...@echo finished WITHOUT errorlog@exit /b 0echo ...echo Analyzing log file for errors...findstr /I /C:"Import terminated unsuccessfully" %LOGFILE%if errorlevel 1 (goto good1) else (goto exception):good1echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"communication" %LOGFILE%if errorlevel 1 (goto good2) else (goto exception):good2echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"errors" %LOGFILE%if errorlevel 1 (goto good3) else (goto exception):good3echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"Snapshot" %LOGFILE%if errorlevel 1 (goto good4) else (goto exception):good4echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"TNS" %LOGFILE%if errorlevel 1 (goto good5) else (goto exception):good5echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"resource" %LOGFILE%if errorlevel 1 (goto good6) else (goto exception):good6echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"deadlock" %LOGFILE%if errorlevel 1 (goto good7) else (goto exception):good7echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"identifier" %LOGFILE%if errorlevel 1 (goto good8) else (goto exception):good8echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"maximum" %LOGFILE%if errorlevel 1 (goto good9) else (goto exception):good9echo ...echo Analyzing log file for ORA- errors...findstr /I /C:"shutdown" %LOGFILE%if errorlevel 1 (goto good10) else (goto exception):good10echo ...echo Analyzing log file for warnings...findstr /I /C:"unable" %LOGFILE%if errorlevel 1 (cmd /c exit 0) else (goto exception)exit /b 0:exceptionexit /b 1



Import and Export Databases

Export database command:
Mysqldump-u root-p mydb2> e: \ mydb. SQL
Export the database mydb2 to the mydb. SQL of the E Disk

Note: Go to the bin directory installed in mysql under dos, but do not log in.

Database Import command:
Mysqldump-u root-p mydb2 <e: \ mydb. SQL
Import mydb. SQL from database disk e to mydb2

Note: Create mydb2 and then use the Import Statement.

Import/Export imp/exp of a database created by an oracle user
The execution environment can be executed in SQLPLUS. EXE or DOS (command line): it can be executed in SQLPLUS. EXE or DOS (command line,
In DOS, the installation directory ora81BIN in oracle 8i is set as a global path,
The EXP. EXE and IMP. EXE files in this directory are used for import and export.

Create user

Add data import permissions to users
First, start SQL * puls
Second, log in with system/manager
Third, create user username identified by password (this step can be omitted if you have already created a user)
Fourth, grant create user, drop user, alter user, create any view,
Drop any view, EXP_FULL_DATABASE, IMP_FULL_DATABASE,
DBA, CONNECT, RESOURCE, create session to Username
Fifth, run-cmd-to enter the directory where the dmp file is located,
Imp userid = system/manager full = y file = *. dmp
Or imp userid = system/manager full = y file = filename. dmp

Example:
F: WorkOracle_Databackup> imp userid = test/test full = y file = inner_policy.dmp 17jquery.com

The following describes the Import and Export instances.
Data export:
1. Export the database TEST completely, and the username system Password manager is exported to D: daochu. dmp.
Exp system/manager @ TEST file = d: daochu. dmp full = y
Exp fang/fang @ ORCL file = d: oais20100401.dmp full = y
Exp oais/oais @ ORCL file = d: oais_mj.dmp full = y
2. Export the tables of system users and sys users in the database
Exp system/manager @ TEST file = d: daochu. dmp owner = (system, sys)
3. Export the inner_policy and policy_staff_relat tables in the database.
Exp aichannel/aichannel @ TESTDB2 file = d: datanewsmgnt. dmp tables = (inner_policy, policy_staff_relat)
Exp fang/fang @ ORCL file = d: oais20100401_essmenu.dmp t ...... full text >>>

When executing the exp command in the dos window to export data, the system prompts "not an internal or external command, or a program that can be run"

Your oracle does not configure the corresponding environment variables. you can locate the exp location and add it to the path ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.