## Prerequisites

There are two ways to backup an Oracle database, RMAN and VSS. For either, to be able to backup the database without having to stop access to it, you will need to put the database into the ARCHIVELOG mode.

If the database is not already in the ARCHIVELOG mode, setting that mode will require restarting the database.

## Back up using RMAN

Create an RMAN script file to back up your database to a location on the server’s local drive:

run {
allocate channel oem_backup_disk1 type disk format 'c:\temp\db_backup\%U';
backup as COPY tag '%TAG' database;
backup as COPY archivelog all not backed up delete all input;
release channel oem_backup_disk1;
}

run {
allocate channel oem_backup_disk1 type disk format 'c:\temp\db_backup\%U' maxpiecesize 1000 G;
backup as COPY tag '%TAG' current controlfile;
release channel oem_backup_disk1;
}


Then add to the client setup on the CFA a run before line that runs that script:

rman target "sys/a@orcl" cmdfile "c:\rman_backup.txt"


In this example, sys is the database username being logged in as, a is the password, and orcl is the name of the database being backed up.

Be sure to include the directory that RMAN will put the database backup into in the file set for the client.

In the example above, it is c:\temp\db_backup.

Once the backup job has backed up the copy of the database, it can be deleted from the server. We can do this by setting Run After Backup. In the example above, it is del /Q c:\temp\db_backup\*.

## Back up using VSS

First, install the Oracle VSS Writer service for the database. This is done with the oraVSSw command:

oraVSSw SID /I


where SID is the database SID.

Be careful to get the SID right, as there will be no warning that you have it wrong, the service will be registered, but will not do anything.

Once the Oracle VSS Writer service has been registered, you should be able to see it in the services msc snap in services.msc.

The service will be listed as the SID added to its name.

By default, this service is configured to run under the local system user, but this user does not normally have adequate access to the database. You need to stop the service, right-click it, go to the Log On tab, and set the service to run as a user who is a member of the ORA_DBA group. Then start the service again. Check with the VSSadmin list writers command that the Oracle VSS Writer for your database is shown (if not, the user the service is running as might not have enough access to the database).

Set the client to include all non-excluded writers, and run the backup. This should backup the database. To restore the database, first you will have to stop it, then browse and restore the job you want to restore, select Oracle VSS Writer, and then click Restore. Then you will have to recover or start the database again.