Proteggere e recuperare i database Oracle in un ambiente Windows
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Prima di iniziare
Prima di poter rilevare, proteggere e montare i database Oracle in un ambiente Windows, assicurati di controllare quanto segue:
Controlla le seguenti impostazioni sul server di database:
Il database Oracle e Oracle Listener
sono in esecuzione (controlla i servizi Windows).
Verifica che esista una voce tns con il nome SID.
Il file tnsnames.ora si trova in
%ORACLE_HOME%\network\admin
Verifica che la voce tns sia valida eseguendo:
%ORACLE_HOME%\bin\tnsping <SID>
Controlla se la modalità di log è impostata su Log archiviato:
sql> archive log list
Se il database è in modalità di log senza archiviazione, ripristina la modalità di log con archiviazione:
sql> shutdown immediate;
sql> startup mount;
sql> alter database archivelog;
sql> alter database open;
Attiva il monitoraggio dei blocchi di modifiche del database. Se la BCT del database è disattivata, il tempo del backup incrementale è interessato. La funzionalità di monitoraggio dei blocchi di modifica è disponibile in Oracle Enterprise Edition. Esegui una query SQL per verificare che il monitoraggio dei blocchi di modifica sia abilitato. Esegui la query:
sqlplus / as sysdba
sql> select * from v$block_change_tracking;
Per attivare il monitoraggio dei blocchi di modifica:
sql> alter database enable block change tracking
using file '<Oracle home directory>\orcl.bct';
Esegui il backup di un database Oracle in un ambiente Windows
Per eseguire il backup di un database Oracle in un ambiente Windows:
Applica un piano di backup per proteggere il database.
Problema noto
Oracle 19c SQLPlus (sqlplus.exe) a volte si blocca su Windows durante l'esecuzione del comando exit (ID documento 2820655.1).
Questo bug è specifico per Windows. Oracle ha confermato che questo problema si verifica nelle versioni 19.10, 19.11 e 19.12 di SQLPlus. Oracle ha fornito le seguenti soluzioni:
Utilizza SQL*Plus 21.1 o versioni successive (o)
Applica la patch:31466370. Questa patch è disponibile per 19.11 e 19.13.
Recupera manualmente i database Oracle in un ambiente Windows utilizzando RMAN in un punto di backup pianificato se l'archivelog non è protetto tramite il backup e il RE
Per recuperare un intero database Oracle in un ambiente Windows:
Imposta l'ambiente del database e avvialo in stato di mancata montaggio utilizzando il file di parametri del volume montato di Backup e RE (ad esempio per un volume del database montato su E:):
Cataloga il file di dati e la cartella del file di archivio
dal volume montato di Backup e RE a RMAN:
rman>run{catalogstartwith'E:\datafile' noprompt;catalog start with 'E:\archivelog'noprompt;}
Ripristina e recupera il database:
rman> run
{
restore database;
recover database;
}
Apri il database con l'opzione di reimpostazione del log:
rman> alter database open resetlogs;
Recupera manualmente i database Oracle in un ambiente Windows utilizzando RMAN in un punto di backup pianificato con il rollforward dell'archivelog protetto da backup e RE
Monta l'immagine dal server del database di origine per il recupero. Monta di nuovo lo snapshot di backup da Backup e RE sul
server Oracle come descritto in Montare un database Oracle come montaggio standard.
Imposta l'ambiente del database e avvialo
in stato di mancata montaggio utilizzando il file di parametri del volume montato di Backup e RE.
In questo esempio, l'immagine di backup del database è montata su E:\ e il log dell'archivio protetto è montato su Z:.
Cataloga la cartella dei file di dati e degli archivi log dall'immagine del database montata di Backup e RE e dall'immagine dell'archivio log in RMAN:
```rmanrman>run{catalogstartwith'E:\datafile' noprompt;catalog start with 'E:\archivelog' noprompt;catalog start with 'Z:\archivelog'noprompt;}```
Ripristina e recupera il database:
```rman
rman> run
{
restore database;
recover database;
}
```
Per un recupero point-in-time specifico, esegui il comando recover come segue:
```rman
rman> run
{
restore database;
recover database until time "to_date('<time stamp>','yyyymmddhh24mi')";
}
```
Apri il database con l'opzione di reimpostazione del log:
```rman
rman> alter database open resetlogs;
```
Il database è disponibile in lettura e scrittura.
Script di monitoraggio per rilevare il montaggio dei volumi del database
Se crei un montaggio consapevole dell'applicazione, puoi utilizzare uno script di monitoraggio per mostrare i volumi montati da Backup e RE e i processi Oracle in esecuzione. I mount consapevoli dell'applicazione sono descritti in
Montare un database Oracle come applicazione virtuale.
Quando esegui un montaggio consapevole dell'applicazione, puoi utilizzare questo script di monitoraggio.
La posizione dello script deve essere: C:\Programmi\Backup and RE\scripts.
Gli script eseguiti su host Windows devono essere file .bat o .vbs.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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"]]