Melindungi dan memulihkan database Oracle di lingkungan Windows
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sebelum memulai
Sebelum Anda dapat menemukan, melindungi, dan memasang database Oracle di lingkungan
Windows, pastikan untuk memeriksa hal berikut:
Periksa setelan berikut di server database:
Database Oracle dan Oracle Listener
sudah aktif dan berjalan (periksa layanan Windows).
Pastikan ada entri tns dengan nama SID.
File tnsnames.ora berada di
%ORACLE_HOME%\network\admin
Verifikasi bahwa entri tns valid dengan menjalankan:
%ORACLE_HOME%\bin\tnsping <SID>
Periksa apakah mode log disetel ke mode Log Arsip:
sql> archive log list
Jika database berada dalam mode log tanpa arsip, kembalikan ke mode log arsip:
sql> shutdown immediate;
sql> startup mount;
sql> alter database archivelog;
sql> alter database open;
Mengaktifkan pelacakan blok perubahan database. Jika BCT database dinonaktifkan,
waktu pencadangan inkremental akan terpengaruh. Fitur pelacakan blok perubahan
tersedia di Oracle Enterprise Edition. Jalankan kueri SQL untuk
memeriksa apakah pelacakan blok perubahan diaktifkan. Jalankan kueri:
sqlplus / as sysdba
sql> select * from v$block_change_tracking;
Untuk mengaktifkan pelacakan blok perubahan:
sql> alter database enable block change tracking
using file '<Oracle home directory>\orcl.bct';
Mencadangkan database Oracle di lingkungan Windows
Untuk mencadangkan database Oracle di lingkungan Windows, ikuti langkah-langkah berikut:
Terapkan rencana cadangan untuk melindungi database.
Masalah umum
Oracle 19c SQLPlus (sqlplus.exe) terkadang mengalami hang di Windows saat menjalankan perintah keluar (ID Dokumen 2820655.1).
Bug ini khusus untuk Windows. Oracle telah mengonfirmasi bahwa masalah ini terjadi di SQLPlus versi 19.10, 19.11, dan 19.12. Oracle memberikan solusi berikut:
Menggunakan SQL*Plus 21.1 atau yang lebih baru (atau)
Terapkan patch:31466370. Patch ini tersedia untuk 19.11 dan 19.13.
Memulihkan database Oracle di lingkungan Windows secara manual menggunakan RMAN ke titik pencadangan terjadwal jika archivelog tidak dilindungi melalui Pencadangan dan DR
Untuk memulihkan seluruh database Oracle di lingkungan Windows:
Tetapkan lingkungan database dan mulai database dalam status tidak terpasang
menggunakan file parameter dari volume yang dipasang Pencadangan dan DR
(misalnya untuk volume database yang dipasang ke E:):
Buat katalog file data dan folder file arsip
dari volume yang dipasang Cadangan dan DR ke RMAN:
rman>run{catalogstartwith'E:\datafile' noprompt;catalog start with 'E:\archivelog'noprompt;}
Pulihkan dan pulihkan database:
rman> run
{
restore database;
recover database;
}
Buka database dengan opsi reset log:
rman> alter database open resetlogs;
Memulihkan database Oracle di lingkungan Windows secara manual menggunakan RMAN ke titik pencadangan terjadwal dengan roll-forward dari Backup dan archivelog yang dilindungi DR
Pasang image dari server database sumber
untuk memulihkan. Pasang snapshot cadangan dari Pencadangan dan DR kembali ke server Oracle seperti yang dijelaskan dalam Memasang database Oracle sebagai pemasangan standar.
Tetapkan lingkungan database dan mulai database
dalam status tidak terpasang menggunakan file parameter dari volume yang dipasang Cadangan dan DR.
Dalam contoh ini, image cadangan database dipasang di: E:\ dan
log arsip yang dilindungi dipasang di: Z:.
Katalogkan folder file data dan archivelog dari image database yang dipasang
dan image log arsip Pencadangan dan DR ke RMAN:
```rmanrman>run{catalogstartwith'E:\datafile' noprompt;catalog start with 'E:\archivelog' noprompt;catalog start with 'Z:\archivelog'noprompt;}```
Pulihkan dan pulihkan database:
```rman
rman> run
{
restore database;
recover database;
}
```
Untuk pemulihan point-in-time tertentu, jalankan perintah pemulihan sebagai berikut:
```rman
rman> run
{
restore database;
recover database until time "to_date('<time stamp>','yyyymmddhh24mi')";
}
```
Buka database dengan opsi reset log:
```rman
rman> alter database open resetlogs;
```
Database tersedia untuk dibaca dan ditulis.
Menonton skrip untuk memantau volume database yang dipasang
Jika membuat pemasangan yang mengetahui aplikasi, Anda dapat menggunakan skrip watch untuk
menampilkan volume yang di-mount dari Cadangan dan DR, serta proses Oracle
yang berjalan. Penyambungan yang terhubung dengan aplikasi dijelaskan dalam artikel Memasang Database Oracle sebagai Aplikasi Virtual.
Saat melakukan pemasangan yang mengetahui aplikasi, Anda dapat menggunakan skrip watch ini.
Lokasi skrip harus: C:\Program Files\Backup and DR\scripts.
Skrip yang dijalankan di host Windows harus berupa file .bat atau .vbs.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eBefore backing up Oracle databases in Windows, ensure the database and listener are running, a valid tns entry exists, and the database is in archive log mode.\u003c/p\u003e\n"],["\u003cp\u003eEnabling database change block tracking is recommended for Oracle Enterprise Edition to reduce incremental backup times.\u003c/p\u003e\n"],["\u003cp\u003eBackups on the windows environment rely on OS authentication and do not support database authentication.\u003c/p\u003e\n"],["\u003cp\u003eRecovering an Oracle database involves mounting a backup snapshot, setting the database environment, restoring the control file using RMAN, and then restoring and recovering the database.\u003c/p\u003e\n"],["\u003cp\u003eA watch script can monitor mounted volumes from Backup and DR and identify running Oracle processes during an application-aware mount.\u003c/p\u003e\n"]]],[],null,["# Protect and recover Oracle databases in a Windows environment\n\nBefore you begin\n----------------\n\nBefore you can discover, protect, and mount Oracle databases in a Windows\nenvironment, be sure to check the following:\n\n1. Check the following settings on the database server:\n\n 1. The Oracle database and the Oracle Listener\n are up and running (check Windows services).\n\n 2. Confirm that there is a tns entry with the name SID.\n The file tnsnames.ora is under\n\n %ORACLE_HOME%\\network\\admin\n\n 3. Verify tns entry is valid by running:\n\n %ORACLE_HOME%\\bin\\tnsping \u003cSID\u003e\n\n2. Check if the log mode is set to Archive Log mode:\n\n sql\u003e archive log list\n\n If the database is in no-archive log mode, then return it to archive log mode:\n **Note:** This will take down the database. \n\n sql\u003e shutdown immediate;\n sql\u003e startup mount;\n sql\u003e alter database archivelog;\n sql\u003e alter database open;\n\n3. Enable database change block tracking. With database BCT off,\n incremental backup time is impacted. Change block tracking feature\n is available in Oracle Enterprise Edition. Run a SQL query to\n check that change block tracking is enabled. Run the query:\n\n sqlplus / as sysdba\n sql\u003e select * from v$block_change_tracking;\n\nTo enable change block tracking: \n\n sql\u003e alter database enable block change tracking\n using file '\u003cOracle home directory\u003e\\orcl.bct';\n\nBack up an Oracle database in a Windows environment\n---------------------------------------------------\n\n| **Note:** Database authentication is not supported for Oracle in a Windows environment. OS authentication is fully supported.\n\nTo back up an Oracle database in a Windows environment, follow these steps:\n\n1. Set the [Application Details \\& Settings for Oracle Databases](/backup-disaster-recovery/docs/backup/app-details-settings-oracle).\n\n2. Apply a backup plan to protect the database.\n\n**Known issue**\n\nOracle 19c SQL*Plus (sqlplus.exe) occasionally hangs on Windows when executing exit command (Doc ID 2820655.1).\nThis bug is specific to Windows. Oracle has confirmed that this issue occurs in SQL*Plus versions 19.10, 19.11 and 19.12. Oracle provided these solutions:\n\n- Use SQL\\*Plus 21.1 or later (or)\n- Apply patch:31466370. This patch is available for 19.11 and 19.13.\n\nRecover Oracle databases in a Windows environment manually using RMAN to a scheduled backup point if the archivelog is not protected through Backup and DR\n----------------------------------------------------------------------------------------------------------------------------------------------------------\n\nTo recover an entire Oracle database in a Windows environment:\n\n1. Mount the database backup snapshot from Backup and DR\n back to the Oracle server as detailed in [Mount an Oracle database as a standard mount](/backup-disaster-recovery/docs/access-data/mount-oracle).\n\n2. Set the database environment and start the database in no-mount state\n using the parameter file from the Backup and DR mounted volume\n (for example for a mounted database volume to E:):\n\n sqlplus / as sysdba\n sql\u003e startup nomount pfile='E:\\\u003csid\u003e___backup.ora';\n\n3. Create spfile from pfile:\n\n sql\u003e create spfile='%ORACLE_HOME%\\database\\spfile\u003csid\u003e.ora'\n from pfile='E:\\\u003csid\u003e___backup.ora';\n\n4. Start the database with spfile in the `nomount` state:\n\n sql\u003e shutdown immediate;\n sql\u003e startup nomount;\n\n5. Restore the control file using RMAN from the Backup and DR mounted volume:\n\n rman target /\n rman\u003e restore controlfile from 'E:\\cf-D_\u003csid\u003e-id_\u003cid\u003e.ctl';\n\n6. Mount the database:\n\n rman\u003e alter database mount;\n\n7. Catalog the datafile and the archive file folder\n from the Backup and DR mounted volume to RMAN:\n\n rman\u003e run\n {\n catalog start with 'E:\\datafile' noprompt;\n catalog start with 'E:\\archivelog' noprompt;\n }\n\n8. Restore and recover the database:\n\n rman\u003e run\n {\n restore database;\n recover database;\n }\n\n9. Open the database with reset log option:\n\n rman\u003e alter database open resetlogs;\n\nRecover Oracle databases in a Windows environment manually using RMAN to a scheduled backup point with roll-forward of Backup and DR-protected archivelog\n---------------------------------------------------------------------------------------------------------------------------------------------------------\n\n1. Mount the image from the source database server\n to recover. Mount the backup snapshot from Backup and DR back to the Oracle\n server as detailed in [Mount an Oracle database as a standard mount](/backup-disaster-recovery/docs/access-data/mount-oracle).\n\n2. Set the database environment and start the database\n in no-mount state using the parameter file from the Backup and DR mounted volume.\n In this example, the database backup image is mounted at: E:\\\\ and\n the protected archive log is mounted at: Z:.\n\n sqlplus / as sysdba\n\n startup nomount pfile='E:\\\u003csid\u003e___backup.ora';\n\n3. Create spfile from pfile:\n\n sql\u003e create spfile='%ORACLE_HOME%\\database\\spfile\u003csid\u003e.ora' from\n pfile='E:\\\u003csid\u003e___backup.ora';\n\n4. Start the database with spfile in the nomount state:\n\n ```sql\n shutdown immediate;\n startup nomount;\n ```\n\n5. Restore the control file using RMAN from the Backup and DR mounted\n archive log image:\n\n ```rman\n rman target /\n rman\u003e restore controlfile from 'Z:\\cf-D_\u003csid\u003e-id_\u003cid\u003e.ctl';\n ```\n\n6. Mount the database:\n\n ```rman\n rman\u003e alter database mount;\n ```\n\n7. Catalog the datafile and archivelog folder from Backup and DR mounted\n database image and archive log image to RMAN:\n\n ```rman\n rman\u003e run\n {\n catalog start with 'E:\\datafile' noprompt;\n catalog start with 'E:\\archivelog' noprompt;\n catalog start with 'Z:\\archivelog' noprompt;\n }\n ```\n\n8. Restore and recover the database:\n\n ```rman\n rman\u003e run\n {\n restore database;\n recover database;\n }\n ```\n\n For a specific point in time recovery run the recover command as follows: \n\n ```rman\n rman\u003e run\n {\n restore database;\n recover database until time \"to_date('\u003ctime stamp\u003e','yyyymmddhh24mi')\";\n }\n ```\n\n9. Open the database with reset log option:\n\n ```rman\n rman\u003e alter database open resetlogs;\n ```\n\n The database is available for read and write.\n\n### Watch script to watch for database volumes being mounted\n\nIf you create an application-aware mount, then you can use a watch script to\nshow the volumes being mounted from Backup and DR, and the Oracle\nprocesses running. Application-aware mounts are described in\n[Mounting an Oracle Database as a Virtual Application](/backup-disaster-recovery/docs/access-data/mount-oracle-virtualdb).\n\nWhen performing an application-aware mount, you can use this watch script.\nThe script location must be: C:\\\\Program Files\\\\Backup and DR\\\\scripts.\nScripts run on Windows hosts must be .bat or .vbs files. \n\n ```Windows\n @echo off\n :loop\n echo. \u003e watchtemp\n echo ------------------ \u003e\u003e watchtemp\n echo Oracle Processes \u003e\u003e watchtemp\n echo ------------------ \u003e\u003e watchtemp\n tasklist /svc | findstr oracle \u003e\u003e watchtemp\n echo. \u003e\u003e watchtemp\n echo ------------------ \u003e\u003e watchtemp\n echo Backup and DR Mounts \u003e\u003e watchtemp\n echo ------------------ \u003e\u003e watchtemp\n wmic volume get label, name | findstr Backup and DR \u003e\u003e watchtemp\n echo. \u003e\u003e watchtemp\n cls\n type watchtemp\n timeout 2 \u003e null\n goto loop\n ```\n\nWhich produces output like this: \n\n Oracle Processes\n ------------------\n oracle.exe 1492 OracleServiceORCL\n oracle.exe 3768 OracleServiceTestDB\n oracle.exe 872 OracleServiceTestDB2\n ------------------\n Backup and DR Mounts\n ------------------\n Backup and DR-Backup-ORCL D:\\mount_1"]]