Wednesday, November 27, 2024

 

RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-recovery-window-is-before-resetlogs-time/

KB0013276

When you are performing a PITR (Point In Time Recovery), you might have undergone the error “RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time”. The reason that RMAN throws this error is when you are trying to perform a PITR of the database to a time before the database was last opened with RESETLOGS. In other words, the time you specify in the “until time” clause of RMAN is the time that the database was in its previous incarnation and not the CURRENT incarnation.


RMAN threw an error saying “RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time”.

executing command: SET until clause
Starting restore at 01-DEC-12
Starting implicit crosscheck backup at 01-DEC-12
RMAN-00571: ===================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =======
RMAN-00571: ===================================================
RMAN-03002: failure of restore command at 12/01/2012 20:26:41

RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

RMAN is trowing this error because the incarnations of the database not matching with PITR. 
Run the “list incarnation” command at RMAN prompt.

 
rman target / catalog /@<rman catalog>

RMAN>spool log to <caseid>_restore.log
RMAN>set echo on
RMAN>ALTER SESSION SET NLS_DATE_FORMAT = 'dd/mm/yyyy hh24:mi:ss';
RMAN>list incarnation of database;
 

DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
294105469 294105470 AMALPRD1 1914393966       PARENT  1          21-AUG-2023 01:21:50
294105469 625758845 AMALPRD1 1914393966       CURRENT 9029509056 26-NOV-2024 15:39:15

** reset database to incarnation <n>;  <-- only if required; n = the appropriate INC Key that your restore until_time falls into, i.e. before resetlogs time)

RMAN> reset database to incarnation 1;

run {
  allocate channel ch00 type disk;
  set until time= "to_date('14/06/2022 14:30:00','dd/mm/yyyy hh24:mi:ss')";
  restore database preview summary;
  release channel ch00;
}

shutdown immediate;
** set dbid=<dbid>;  <-- only required if the DBID is different, otherwise no need to set it.

run {
startup nomount;
set until time= "to_date('14/06/2022 14:30:00','dd/mm/yyyy hh24:mi:ss')";
restore controlfile;
alter database mount;
restore database;
recover database;
}
alter database open resetlogs;
select * from v$instance;
select con_id, dbid, name, open_mode, restricted, open_time from v$containers;

spool log off;
exit;

Wednesday, April 10, 2024


Query to Check available Space of an Oracle Database


Login to the database as SYS user

sqlplus as / sysdba

Then copy and paste below sql query in the command line or PL/SQL editor

select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size",
round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space",
round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
from (select    bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used,
(select sum(bytes) as p from dba_free_space) free
group by free.p;

Wednesday, October 26, 2022

 

Windows: How To Delete and Recreate the TNS Listener Service When the Service Fails To Start Consistently At Machine Reboot (Doc ID 313250.1)


APPLIES TO:

Oracle Net Services - Version 8.1.7.4.0 and later
Microsoft Windows x64 (64-bit) - Version: 2008 R2
Microsoft Windows (32-bit)
Microsoft Windows (32-bit)Microsoft Windows

GOAL

Oracle TNS Listener service fails to start automatically at boot time (e.g. after moving Windows Server to new location) or fails to start manually.

SOLUTION

You need to re-create the Windows service associated to the Oracle listener by deleting the Windows service and creating a new service for the Oracle TNS Listener.

1. Deleting the service

At your earliest convenience, or next scheduled maintenance window, delete and recreate the Windows service associated to the Oracle TNS Listener. You can do this either with the help of a tool (recommended) or by hand-editing the registry. In both cases you need to stop the listener service before making any changes.

Using a tool
There are quite a few tools to manipulate Windows services, in the Resource Kit or from third parties. Also there is a tool called SC and which is available in the base Windows distribution (at least for Windows XP and Windows 2003).

  1. Lookup the windows service name that you want to remove — use Properties in the Windows Services panel to copy the full name
  2. Open a Command Prompt window and run the following:
    sc delete <your_windows_Service_name>
  3. Check that the Windows service has been removed — use F5/Refresh in the Windows Services panel

In case you do not have the SC tool available then you need to download the Windows Resource Kit — there you will find the instsrv.exe tool.

  1. Lookup the windows service name that you want to remove — use Properties in the Windows Services panel to copy the full name
  2. Open a Command Prompt Window and run the following:
    instsrv /deleteService <your_windows_Service_name>
  3. Check that the Windows service has been removed — use F5/Refresh in the Windows Services panel


Manually editing the Windows Registry

Warning: editing the Windows Registry by hand is dangerous and may render your system unusable. Proceed at your own risk !


You need to follow these steps:

  • Launch the Registry Editor (e.g. Start / Run / regedit )
  • Drill down to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  • Locate and delete the the key which contains your Oracle Home name and your listener name (e.g. OracleOraHomeTNSListenerName)
  • Reboot the system

 

2. Creating the new service

When started and logged on as the Oracle user, go to a Command Prompt and start the listener:

lsnrctl start <listener_name>

Replace <listener_name> with the name of your listener; if you are operating on the default listener then you may use the value LISTENER or leave it empty.

An OS error 1060 will be seen (which is normal as the Windows service is missing and is being created); the listener should start correctly.

3. Test the listener

Once started the listener is started, check that a Windows service for the TNS Listener was created in the Window Services panel and set to startup automatically (change if necessary). Then test the automatic listener startup by performing another reboot.

Tuesday, September 27, 2022

 

How to recover missing datafiles?

ORA-01110: ORA-01565:  ORA-27041

Recovery of SID went wrong though the DB opened successfully because unfortunately we used old control file and missed almost 11 data files in controlfile.sql file and which created soft link in dbs path.

In order to overcome the situation below steps performed and database become consistent. If in case in the future if we face same issue, we can use below steps confidently.

1) Find the missing datafiles:

SQL> set line 250

SQL> col FILE_NAME for a45
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME,ONLINE_STATUS from dba_data_files;
/oracle/SID/121/dbs/MISSING00268                     268 PSAPSID  ONLINE
/oracle/SID/121/dbs/MISSING00269                     269 PSAPSID ONLINE
 
2) Take tablespace or datafiles offline:
Come with below error because data file already in offline
SQL> alter database datafile ‘/oracle/SID/sapdata/sapdata2/gp1_242/gp1.data242’ offline;
Database altered.
SQL> alter database datafile ‘/oracle/SID/sapdata/sapdata2/gp1_243/gp1.data243’ offline;
Database altered.
 
3) Rename missing datafiles with original files: 
SQL> alter database rename file ‘/oracle/SID/121/dbs/MISSING00268’ to ‘/oracle/SID/sapdata/sapdata2/gp1_242/gp1.data242’;
SQL> alter database rename file ‘/oracle/SID121/dbs/MISSING00269’ to ‘/oracle/SID/sapdata/sapdata2/gp1_243/gp1.data243’;
4) Shutdown and mount the database:
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 6.4425E+10 bytes
Fixed Size                  3729840 bytes
Variable Size            7381976656 bytes
Database Buffers         5.6908E+10 bytes
Redo Buffers              130486272 bytes
Database mounted.
5) Perform media recovery:
SQL> recover datafile 268;
Media recovery complete.
SQL> recover datafile 279;
Media recovery complete.
6) Open the database:
SQL> alter database open;
Database altered.
7) check the status of datafiles:
SQL> set line 250
SQL> col FILE_NAME for a45
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME,ONLINE_STATUS from dba_data_files;  – After recovery data files online_status went recover to offline.
8) Bring the datafiles online:
SQL> alter database datafile ‘/oracle/SID/sapdata/sapdata2/gp1_242/gp1.data242’ online;
Database altered.
SQL> alter database datafile ‘/oracle/SID/sapdata/sapdata2/gp1_243/gp1.data243’ online;
Database altered.
9) check again the status of datafiles:
SQL> set line 250
SQL> col FILE_NAME for a45
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME,ONLINE_STATUS from dba_data_files;

Friday, September 2, 2022

 

ORA-12557: TNS:protocol adapter not loadable


Question:  What causes the ORA-12577 error below?  I am running on Windows.

ORA-12557: TNS:protocol adapter not loadable

The ORA-12577 error is related to Windows Environment or Oracle Home PATH because sqlplus command works smoothly when I execute it inside ORACLE_HOME\bin.

Answer:  There are two solutions to this issue:

1 - put the Oracle DB Home in front of the other paths in the PATH environment variable.

2 - Remove ORACLE_HOME From environment Variable and re-boot PC

Oracle author Osama Mustafa notes a solution to the ORA-12577 error.

RUN: SYSDM.CPL to open Windows System Properties

Click on Advanced Tab > Environment Variables…

Click the Path variable under System Variable, then click Edit…

Change the order between Oracle Client Home and Oracle DB Home:

From: D:\oracle\product\10.2.0\client_1\bin;D:\oracle\product\10.2.0\db_1\bin;

To: D:\oracle\product\10.2.0\db_1\bin;D:\oracle\product\10.2.0\client_1\bin;

In other words, put the Oracle DB Home in front of the other path.

Wednesday, July 6, 2022

 How to set FILESYSTEMIO_OPTIONS for use with RSA Identity Governance and Lifecycle on a remote Oracle database where Automatic Storage Management (ASM) is not being used for better storage performance 

Tuesday, July 5, 2022

 

ORA-01012: not logged on error

HOME » ORA-01012: NOT LOGGED ON ERROR

ORA-01012: not logged on error while trying to start the oracle database.







Solution:

To resolve this error  remove the orphaned shared memory segment using sysresv utility. sysresv command will list the currently allocated IPC resources for shared memory and remove the shared memory segment using ipcrm -m command.





Now start the database



 

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...