top of page

Groupe de soutien

Public·29 membres
Kasim Dmitriev
Kasim Dmitriev

Simple Batch File For Oracle Database Backup

In many case, we need to take the Cold backup. I am happy to share this batch file, which will take the full database backup and finally it will automatically start the database after the Cold backup.

Simple batch file for Oracle database backup

Download Zip:

A simple batch file for taking date-wise expdp of a schema is given below: @ECHO OFF : Sets the proper date and time stamp with 24Hr Time for log file naming : convention SET HOUR=%time:0,2% SET dtStamp9=%date:-4%%date:4,2%%date:7,2%_0%time:1,1%%time:3,2%%time:6,2% SET dtStamp24=%date:-4%%date:4,2%%date:7,2%_%time:0,2%%time:3,2%%time:6,2% if "%HOUR:0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%) set PATH=D:\oracle\product\10.2.0\db_1\BIN;%PATH% --> set your own path D:\oracle\product\10.2.0\db_1\BIN\expdp aiwa/aiwa@proddb dumpfile=prod_aiwa_%dtStamp%.dmp logfile=prod_aiwa_%dtStamp%.log directory=DATA_PUMP_DIR schemas=aiwa pause

In the following article, I will introduce the detailed steps to create backup batch file in Windows 10. If you find it complicated or not flexible enough, you can also use a GUI-based file backup solution to automate the backup task - it not only makes the process easier, but also provides more comprehensive functionality to backup files in Windows 10, such as image backup and file sync.

First, you need a text editor to input the backup commands and save it with .bat extension. Thus every time you double-click the script file, these commands will be performed automatically. Furthermore, you could use Windows Task Scheduler to run the task on regular basis.

When you use batch file to backup files in Windows 10, you are actually synchronizing them from source to target with original folder structure, and the copied files could be accessed and used directly. However, it will not keep different copies of a frequently modified directory. When you do something wrong with it and the changes have been auto copied to the target directory, it is very difficult to retrieve any previous version.

To fulfill your different backup needs, free backup software like AOMEI Backupper Standard can be a more complete solution. It enables you to sync files with the original format as well as backup them to image files. And either way, you could do a very simple setup to schedule automatic backup or sync.

Creating backup batch file in Windows 10 could simplify and automate the process, especially when you want to perform the same tasks regularly. But if you want more complete backup modes with simple operation, AOMEI Backupper is a reliable choice.

This batch file uses the expdp tool provided by Oracle and the 7-zip archiver to compress the exports for archival. The export tool itself creates a full export of the whole database (full=y). Also, the flashback_time parameter is specified to get a consistent export.

Although the database depends on other types of files, such as network configuration files, password files, and the contents of the Oracle home, you cannot back up these files with RMAN. Likewise, some features of Oracle Database, such as external tables, may depend upon files other than the data files, control files, and redo log. RMAN cannot back up these files. Use general-purpose backup software such as Oracle Secure Backup to protect files that RMAN does not support.

When you execute the BACKUP command in RMAN, the output is always either one or more backup sets or one or more image copies. A backup set is an RMAN-specific proprietary format, whereas an image copy is a bit-for-bit copy of a file. By default, RMAN creates backup sets.

You can use the BACKUP command to make consistent and inconsistent backups of the database. A consistent backup occurs when the database is in a consistent state. A database is in a consistent state after being shut down with the SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands. A consistent shutdown guarantees that all redo has been applied to the data files. If you mount the database and make a backup at this point, then you can restore the database backup later and open it without performing media recovery. But you will, of course, lose all transactions that occurred after the backup was created.

Any database backup that is not consistent is an inconsistent backup. A backup made when the database is open is inconsistent, as is a backup made after an instance failure or SHUTDOWN ABORT command. When a database is restored from an inconsistent backup, Oracle Database must perform media recovery before the database can be opened, applying changes from the redo logs that took place after the backup was created.

RMAN does not permit you to make inconsistent backups when the database is in NOARCHIVELOG mode. If you employ user-managed backup techniques for a NOARCHIVELOG database, then you must not make inconsistent backups of this database.

If the database runs in ARCHIVELOG mode, and you back up the archived redo logs and data files, inconsistent backups can be the foundation for a sound backup and recovery strategy. Inconsistent backups offer superior availability because you do not have to shut down the database to make backups that fully protect the database.

When performing a user-managed backup of an online tablespace or database, an operating system utility can back up a data file at the same time that the database writer (DBWR) is updating the file. It is possible for the utility to read a block in a half-updated state, so that the block that is copied to the backup media is updated in its first half, while the second half contains older data. This type of logical corruption is known as a fractured block, that is, a block that is not consistent with an SCN. If this backup must be restored and the block requires recovery, then recovery fails because the block is not usable.

Unlike user-managed tools, RMAN does not require extra logging or backup mode because it knows the format of data blocks. RMAN is guaranteed not to back up fractured blocks. During an RMAN backup, a database server session reads each data block and checks whether it is fractured by comparing the block header and footer. If a block is fractured, then the session rereads the block. If the same fracture is found, then the block is considered permanently corrupt. Also, RMAN does not need to freeze the data file header checkpoint because it knows the order in which the blocks are read, which enables it to capture a known good checkpoint for the file.

RMAN can store backup data in a logical structure called a backup set, which is the smallest unit of an RMAN backup. A backup set contains the data from one or more data files, archived redo logs, control files, or server parameter file. Backup sets, which are only created and accessed through RMAN, are the only form in which RMAN can write backups to media managers such as tape drives and tape libraries.

A backup set contains one or more binary files in an RMAN-specific format. Each of these files is known as a backup piece. A backup set can contain multiple data files. For example, you can back up 10 data files into a single backup set consisting of a single backup piece. In this case, RMAN creates one backup piece as output. The backup set contains only this backup piece.

If you specify the SECTION SIZE parameter on the BACKUP command, then RMAN produces a multisection backup. This is a backup of a single large file, produced by multiple channels in parallel, each of which produces one backup piece. Each backup piece contains one file section of the file being backed up.

To create encrypted backups on disk with RMAN, the database must use the Advanced Security Option. For encrypted RMAN backups directly to tape, the Oracle Secure Backup SBT is the only supported interface.

You can either let RMAN determine a unique name for backup pieces or use the FORMAT clause to specify a name. If you do not specify the FORMAT parameter, then RMAN automatically generates a unique file name with the %U substitution variable in the default backup location.

The FORMAT clause supports substitution variables other than %U for generating unique file names. For example, you can use %d to generate the name of the database, %I for the DBID, %t for the time stamp, and so on.

If you specify the SECTION SIZE parameter on the BACKUP command, then RMAN can create a multisection backup. In this case, a single backup set can contain multiple backup pieces, each containing a file section. The purpose of multisection backups is to enable multiple channels to back up a large file in parallel.

The total number and size of backup sets depends mostly on an internal RMAN algorithm. However, you can influence RMAN behavior with the MAXSETSIZE parameter in the CONFIGURE or BACKUP command. By limiting the size of the backup set, the parameter indirectly limits the number of files in the set and can possibly force RMAN to create additional backup sets. Also, you can specify BACKUP ... FILESPERSET to specify the maximum number of files in each backup set.

When creating backup sets, RMAN can simultaneously read multiple files from disk and then write their blocks into the same backup set. For example, RMAN can read from two data files simultaneously, and then combine the blocks from these data files into a single backup piece. The combination of blocks from multiple files is called backup multiplexing. Image copies, by contrast, are never multiplexed.

As Figure 8-1 illustrates, RMAN can back up three data files into a backup set that contains only one backup piece. This backup piece contains the intermingled data blocks of the three input data files.

RMAN multiplexing is determined by several factors. For example, the FILESPERSET parameter of the BACKUP command determines how many data files to put in each backup set. The MAXOPENFILES parameter of ALLOCATE CHANNEL or CONFIGURE CHANNEL defines how many data files RMAN can read from simultaneously. The basic multiplexing algorithm is as follows: 350c69d7ab

À propos

Bienvenue sur le groupe ! Vous pouvez entrer en contact avec...


bottom of page