- 11 Backing Up and Recovering
- Backing Up and Restoring the Database
- About Backing Up and Re storing the Database
- Enabling ARCHIV ELOG Mode for Media Failure Protection
- Viewing the Current ARCH IVELOG Mode Setting
- Turning on ARCH IVELOG Mode
- Backing Up the Database
- Scheduling Automatic Backups
- Restoring and Recovering the Database
- Sql developer oracle restoring windows
- Oracle SQL Developer
- The World’s #1 Tool for Managing your Oracle Database
- SQL Developer
- Установка Oracle SQL Developer 4.0.3 и настройка подключения с сервером
- Для чего нужен SQL Developer?
- Где скачать Oracle SQL Developer?
- Установка SQL Developer
- Установка Java SE Development Kit 7u72 (JDK)
- Запуск SQL Developer 4.0.3
- Настраиваем подключение с сервером и базой данных
11 Backing Up and Recovering
This section discusses backing up and restoring the entire database and recovering data from individual schema objects. It includes the following topics:
Backing Up and Restoring the Database
This section includes the following topics:
About Backing Up and Re storing the Database
Backing up and restoring Oracle Database XE is based on protecting the physical files that make up the database: the datafiles, the control file, the server parameter file ( SPFILE ), and, if in ARCHIVELOG mode, the redo log files.
In Oracle Database XE, the database backup and recovery facility is based upon the Recovery Manager ( RMAN ) utility that is integrated into the database. Although there is an RMAN command line client similar to the SQL Command Line, you do not need to interact with it directly to back up or restore your database. Oracle Database XE includes backup and restore scripts that you access using menu choices on your desktop. These scripts perform a full backup and restore of the entire database, and store backup files in the flash recovery area.
Automatic Manag ement of Backup Storage
Oracle Database XE implements a backup re tention policy that dictates that two complete backups of the database must be retained, to provide a level of redundant protection for the database. In ARCHIVELOG mode, all archived logs required for media recovery from either backup are also retained. The database automatically manages backups and archived logs in the flash recovery area, deleting any that are obsolete (no longer needed to satisfy the retention policy) as space is needed for new files. The backup script provided with Oracle Database XE also deletes obsolete backups and archived logs at the end of each backup job.
The provided backup script performs online backups of a database that is in ARCHIVELOG mode and offline backups of a database that is in NOARCHIVELOG mode. Online backups are backups that can run while the database is running. Offline backups are backups that run when the database is in the mounted (but not open) state. For offline backups, the backup script automatically puts the database in the proper state. During offline backups, the database is unavailable to your applications.
You run the backup script by running the Backup Database command from the desktop.
Resto re Script
The provided restore script restores the database differently depending on whether log archiving is on or off:
Log archiving on ( ARCHIVELOG mode)—The restore script restores the backed up database files, and then uses the online and archived redo log files to recover the database to the state it was in before the software or media failure occurred. All committed transactions that took place after the last backup are recovered, and any uncommitted transactions that were under way when the failure took place are rolled back (using undo data from the restored undo tablespace).
Log archiving off ( NOARCHIVELOG mode)—The restore script restores the database to its state at the last backup. Any transactions that took place after the last backup are lost.
You run the restore script by running the Restore Database command from the desktop.
Oracle Database Backup and Recovery User’s Guide for more information on Oracle database backup and recovery with RMAN
Enabling ARCHIV ELOG Mode for Media Failure Protection
This section describes how to turn on ARCHIVELOG mode so that your database is fully protected not only against operating system and Oracle instance failure, but also against media (disk) failure. The following topics are covered:
Viewing the Current ARCH IVELOG Mode Setting
To view the current ARCHIVELOG mode setting:
Using the SQL Command Line, log in to the database and connect as SYSDBA , as described in «Logging In and Connecting to the Database as SYSDBA».
Enter the following command:
The LOG_MODE value will be either ARCHIVELOG (that is, on) or NOARCHIVELOG (that is, off).
Turning on ARCH IVELOG Mode
Turning on ARCHIVELOG mode is a one-time operation. After it is turned on, it remains on until you turn it off. Restarting the database does not change the ARCHIVELOG mode setting.
If you turn on ARCHIVELOG mode, you must perform regular backups of the database to avoid completely filling the flash recovery area. A completely filled flash recovery area can lead to database failure.
To turn on ARCHIVELOG mode:
Using the SQL Command Line, log in to the database and connect as SYSDBA , as described in «Logging In and Connecting to the Database as SYSDBA».
At the SQL Command Line prompt, enter the following command:
If the command is successful, it displays the following output.
At the SQL Command Line prompt, enter the following command:
If the command is successful, it displays the following output. (System global area sizes will vary depending on the amount of physical memory in your Oracle Database XE host computer.)
Enter the following command:
If the command is successful, it displays the following output:
Enter the following command:
If the command is successful, it displays the following output:
The database is now running with the new ARCHIVELOG mode setting.
Change the size of the flash recovery area to at least 15 gigabytes to allow for the extra space required for archived log files.
For example, to set the flash recovery area size to 20 gigabytes, enter the following command:
To turn off ARCHIVELOG mode (that is, to set NOARCHIVELOG mode), follow the previous steps 1 through 5, but enter the following command in Step 4:
When you change the ARCHIVELOG mode setting for your database, all of your existing backups become unusable. You must immediately perform a backup after changing the ARCHIVELOG mode, as described in «Backing Up the Database».
«Shutting Down the Database Using the SQL Command Line» for information on how to handle a failed SHUTDOWN IMMEDIATE command.
Backing Up the Database
If ARCHIVELOG mode is on, the script performs an online backup. The database is available during the backup.
If ARCHIVELOG mode is off, the script performs an offline backup. The database is shut down during the backup and restarted afterwards. Your applications are unavailable during the backup.
To back up the database:
Do one of the following:
On Windows: Log in to the Oracle Database XE host computer as a user who is a member of the ORA_DBA user group. This is typically the user that installed Oracle Database XE.
On Linux: Log in to the Oracle Database XE host computer as a user who is a member of the dba user group. This is typically the oracle user.
Do one of the following:
On Windows: Click Start , point to Programs (or All Programs) , point to Oracle Database 11g Express Edition , and then select Backup Database .
On Linux with Gnome: In the Applications menu, point to Oracle Database 11g Express Edition , and then select Backup Database .
On Linux with KDE: Click the icon for the K Menu, point to Oracle Database 11g Express Edition , and then select Backup Database .
A console window opens so that you can interact with the backup script.
If running in ARCHIVELOG mode, the script displays the following output:
If running in NOARCHIVELOG mode, the script displays the following output:
If prompted, enter y and press Enter to confirm the database shutdown and begin the backup.
After the backup is complete, the script displays the following output:
where location is the location of the log file.
Press Enter to close the Backup Database window.
Logs containing the output from the last two backups are stored in the locations listed in Table 11-1.
Table 11-1 Backup Script Output Log Locations
Platform | Location |
---|---|
Platform | Backup Script Name and Path |
---|---|