The data in Oracle is backed up.
Description:
Usage Prerequisites:
The Oracle client needs to be configured.
Function:
Back up the Oracle database.
Description
Newly backed up database in the backup directory, the last backup is stored in the Old_backup directory, the files in the Old_backup are deleted before each backup, and then the last backup data is copied to the Old_backup directory before the backup.
Key scripts:
Exp.txt
*****************************
userid=System/[email protected]
Owner=Scott
Indexes=y
Grants=y
Rows=y
Constraints=y
Compress=n
*****************************
Oracle_bakup.bat
*****************************
del/q. \old_backup\* *
Copy.. \backup\*. *. \Old_backup
del/q. \backup\* *
Oracle_bakup.vbs
*****************************
Oracle_bakup.vbs
*****************************
Option Explicit
On Error Resume Next
Dim fname, cmd
Dim WshShell
Set WshShell = CreateObject ("Wscript.Shell")
fname = Date
CMD = "Exp Log=". /backup/"& fname &" _oracle_bak.log file=: /backup/"& fname &" _oracle_bak.dmp parfile=exp.txt"
Wshshell.run cmd
Set WshShell = Nothing
' WScript.Echo cmd
*****************************
Then a backup folder and a Old_backup folder
Backup steps:
1. Modify the Script/exp.txt file
The main modified parameters are:
Userid=system/[email protected]: This is to use that user to back up the database and indicate the connected database
Here, the database is backed up with the system user, whose password is manager and the database to be backed up is xyj. This section is generally to be changed.
Owner=scott: Which user to back up, in this case, to back up the Scott user. If you want to back up multiple users, separate the user names with a comma ', '. This section is generally to be changed.
If you back up the Scott user with the system user, then ' Owner=scott,system '.
This additional parameter is available if you are familiar with the EXP Backup tool. You can also add additional parameters to the Exp.txt file.
View Exp's Help:dos> exp-help
2. Run the Script\oracle_bakup.bat backup database. You can add the file to the Windows Task Manager to enable automatic backup.
Http://blog.sina.com.cn/s/blog_55fb522f01000abj.html
===================================
===================================
VBS One-click Backup of Oracle Database
Database backup is the most common work of the network manager's Daily server maintenance, the current popular database provides a relatively perfect database automatic backup function, but in the actual work often need to customize some special database backup operations, so that the database backup work more "personalized", Therefore, it is difficult to complete directly using the program tools provided by the database system. To enable more flexible database backup operations, the author uses the VBS script to automate a one-click backup of the remote Oracle database, using the VBS technical documentation and Oracle database documentation.
The EXP.EXE tool is commonly used for data export operations in an Oracle database system, but because the program is a command-line-based program that requires more complex parameters to be entered during use, it is generally written in a batch file, but the Windows Batch command has limited functionality, and I want to be able to use the backup data Time as a file name for backup, and then compress save, so the use of General batch command is difficult to complete, so I decided to use VBS to write a script to complete the corresponding operation.
Tip: EXP.EXE must be used on computers that have an Oracle client installed with the following format:
Exp. EXE [Username]/[password]@[name] file=[filename]
Where [username] is the user name, [password] is the password, [filename] is the target file name that needs to be backed up, [name] is the connection string set in Tnsnames.ora, the specific Tnsnames.ora configuration is not described in this article.
The VBS script is a script belonging to the WSH technology that can call EXP.EXE for backup operations of the database by using the Run method of the Wscript.Shell object, and you can use the DATE function in VBS to get the current system time. According to the above ideas to write the database backup sub-program ORACLEEXP, such as the accompanying code, Where the app is the full pathname of the EXP.EXE program, user and pass are the database connection username and password, dir is the backup data destination path, CONSTR is the database connection string, which is the connection string set in Tnsnames.ora in the prompt earlier in this article.
Through the above sub-program can be implemented remote database backup, but the general database backup is at least hundreds of trillion, a large amount of data seriously wasted the system's disk space resources, so the general DBA will use compression software such as WinRAR to compress the data. Can the script automatically implement data compression? Obviously can be called through the VBS script winrar to complete the compression task, but generally experienced administrators will choose to try not to install redundant software on the server, so the author here to choose the operating system comes with the MakeCab.exe of this practical small tool for data compression work.
MakeCab.exe is a command-line tool that comes with the Windows 2000/xp/2003 system and can package one or more files into a cab format file. Because the CAB format is the installation package format of the Microsoft Publisher program, it is possible to open directly without installing any software under the operating system, and the compression ratio of reasonable compression parameters can reach the compression rate of commercial compression software such as WinRAR.
Tip: MakeCab.exe is used in the following ways:
makecab.exe/d compressiontype=lzx/d compressionmemory=21 [Fullfilename]
where/d compressiontype=lzx settings apply to LZX compression algorithm for compression,/d compressionmemory=21 Set compression parameters, 21 represents the current maximum compression ratio. [Fullfilename] is the path name of the destination file.
Finally, the backup and compression of database data is implemented by using the full VBS script in the appendix, and the file name of the data backup can be customized according to the requirements of the program, in this case, the date of backup is used as the backup name. Using scripts for backup is more flexible than using a command-line tool or a batch command backup with data backup, and the control of a VBS script can call other applications to further process the backed-up data, which greatly expands the scope of the application and provides a viable solution for custom backups.
Because the script saves sensitive information such as database user name and password, if the security has high requirements, you can download the Windows Script Encoder tool from the Microsoft Web site to easily encrypt the script, basically to meet the general security requirements.
Attached: VBS One-click Backup script
' Backing up data in an Oracle database
Function Oracleexp (APP,USER,PASS,DIR,CONSTR)
Dim Wshell,file
Set Wshell = CreateObject ("Wscript.Shell")
File = Dir & "\" & Replace (CStr (Date), "-", "") & ". DMP"
makedumpcmdstring = App & "& User &"/"& Pass & Constr &" file= "& File
Wshell. Run Makedumpcmdstring,1,true
Set Wshell = Nothing
Oracleexp = File
End Function
' Open the folder where the database files are backed up.
Sub Opendir (Dir)
Dim Wshell
Set Wshell = CreateObject ("Wscript.Shell")
makedumpcmdstring = "C:\Windows\Explorer.exe" & Dir
Wshell. Run Makedumpcmdstring,1,true
End Sub
' Compress the database backup file
Sub makecabinet (Fullfilename)
Dim Wshell,fso
Set Wshell = CreateObject ("Wscript.Shell")
makedumpcmdstring = "makecab.exe/d compressiontype=lzx/d compressionmemory=21" & Fullfilename & "" & Repla CE (CSTR (Date), "-", "") & ". cab"
Wshell. Run Makedumpcmdstring,1,true
Set FSO = WScript.CreateObject ("Scripting.FileSystemObject")
Fso. DeleteFile (Fullfilename)
Set FSO = Nothing
Set Wshell = Nothing
End Sub
' Program entry
Dim Cmd,user,dir
Dim DumpFile
' Run parameters
cmd = "E:\oracle\ora90\BIN\EXP. EXE"
user = "oracleuser"
pass = "oraclepassw0rd"
dir = "e:\ database backup "
Constr = "@DB"
MsgBox "Start backup? ", vbOK," Start "
DumpFile = Oracleexp (CMD,USER,PASS,DIR,CONSTR)
Makecabinet DumpFile
Opendir dir ' Open dir folder
Http://blog.jspi.cn/user1/12/archives/2007/3004.html
To Configure the client :
Http://wenku.baidu.com/view/7640884ef7ec4afe04a1df82.html
Http://www.docin.com/p-210451078.html