AT : Schedule tasks to be performed at a specified time and date. |
Delete a Service in Windows using SC ( Service Control) |
Thursday, July 3, 2008
DOS COMMANDS
AT - Schedule tasks to be performed at a specified time and date
Enables users to schedule tasks to be performed at a specified time and date.
C:Documents and Settings>at /?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command. ( Note : Use "net start" to verifty the service is running)
AT [\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"
\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
Examples
At 22:00 every night run a batch script called rman_backup.bat
C:Documents and SettingsAdministrator>AT 22:00 /every:M,T,W,Th,F,S,Su cmd /c "L:Backuprman_backup.bat"
Added a new job with job ID = 1
Running at on its own gives a detailed list of all jobs available
C:Documents and SettingsAdministrator>AT
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Each M T W Th F S Su 16:55 PM cmd /c "C:Documents and SettingsAdministratorhello.BAT"
To delete a scheduled job
C:Documents and SettingsAdministrator>AT 1 /DELETE
To check the status of a job
C:Documents and SettingsAdministrator>AT 1
Task ID: 1
Status: OK
Schedule: Today
Time of day: 16:55 PM
Interactive: No
Command: C:Documents and SettingsAdministratorhello.BAT
Tuesday, July 1, 2008
NTP Setup AIX Client Side
Within any production environment it is advisable to implement an ntp server to
synchronize the date and time of all you server to one central clock. To configure
this on and AIX ( Client Side) , perform the following:
The client configuration for ntp is defined in the configuration file /etc/ntp.conf
and should resemble the following , where server point to the ip address of the ntp
server
root#> more xntp.conf
server 10.101.50.6
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace
# To start the xntpd daemon, enter:
startsrc -s xntpd
# To stop the xntpd daemon, enter:
stopsrc -s xntpd
to configure xntpd to start up at boot time
Edit the /etc/rc.tcpip file, and near the bottom uncomment the
'start xntpd' line. This will ensure ntp client restart on reboot.
e.g.
root#> stopsrc -s xntpd
0513-044 The /usr/sbin/xntpd Subsystem was requested to stop.
root#> ps -ef | grep xntpd
root 499964 581830 0 12:33:58 pts/1 0:00 grep xntpd
root#> startsrc -s xntpd
0513-059 The xntpd Subsystem has been started. Subsystem PID is 499966.
root#> ps -ef | grep xntpd
root 499966 209062 0 12:34:10 - 0:00 /usr/sbin/xntpd
root 532568 581830 0 12:34:13 pts/1 0:00 grep xntpd
root#> date
Sun May 4 12:34:16 BST 200
Note : The /etc/rc.tcpip startup script which defines the TCP/IP daemons is called at boot time by
/etc/inittab
i.e.
root#> grep tcpip inittab
rcptcpip:23456789:wait:/etc/rc.tcpip > /dev/console 2>&1 # Start TCP/IP daemons
Monday, June 30, 2008
ORA-20000: ORU-10027: buffer overflow, limit of 1000000 bytes
Example
Inserting record with ID: 41248
DECLARE
*
ERROR at line 1:
ORA-20000: ORU-10027: buffer overflow, limit of 1000000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "BIMA.LOBAUDIT", line 129
ORA-06512: at line 5
Details
The above error was caused by the fact that dbms_output.putline has reached its buffer
limit of 1000000 bytes , this is an absolute limit. This limit does not exist for 10GR2 and above
Solution
The best solution is to use an alternative method to create a log file such as "create directory method" , or the
less secure UTL_FILE approach , a simple "spool" will also work.
For 10GR2 and above this limit does not exist you can get around this issue as follows set serveroutput on size unlimited
format word_wrapped.
Monday, June 9, 2008
RMAN-06091 no channel allocated for maintenance (of an appropriate type)
Example
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 06/03/2008 23:22:20
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
Details
Backups failing due to the following when running any of the following options with "delete obsolete"
RMAN> delete obsolete;
RMAN> delete noprompt obsolete;
RMAN> delete force obsolete;
Solution
Run the following to specify the device type , in this example use device type disk
RMAN> delete noprompt obsolete device type disk;
In this example the device type disk was allocated for maintenance
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
run
{
report obsolete;
CROSSCHECK BACKUP;
CROSSCHECK COPY;
DELETE EXPIRED BACKUP;
DELETE EXPIRED COPY;
delete obsolete;
}
release channel;
ORA-00344 : unable to recreate
ORA-00344 unable to re-create
Example
RMAN> alter database open resetlogs;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 06/09/2008 10:03:56
ORA-00344: unable to re-create online log 'D:ADMINDATAFILESREDOREDO03.LOG'
ORA-27040: skgfrcre: create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
In the example above we try to perform an "alter database open resetlogs" however we get an IO
error due the fact that the directory path "D:ADMINDATAFILESREDO" does not exist.
An additional side note is that in this example only the directory structure needs to be recreated ,
you do not need to have an actual redo log on file system , an "open resetlogs" will create a new
redo log as specified in the control file.
Details
ORA-00344: unable to re-create
ORA-27040: skgfrcre: create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
ORA-00344 is an IO error , you may have tried to open a database with incorrect redo log locations
specified in the control file.
Solution
You can either recreate the directory structure as specified in the error.
Create a new control file with the desired directory structure for the redo logs.
Tuesday, June 3, 2008
VERIFY CATCPU.SQL WAS EXECUTED
Strangley enough people often apply Oracle CPU's (Critical Patch Updates) without running catcpu.sqlWhen you apply CPU (Critical Patch Update ) on a Oracle home you are patching the binaries only.
onces the binaries have been upgraded.
Check the readme for the CPU (Critical Patch Update ) for instruction on how catcpu.sql is executed.
The readme is accompanied with the patch from metalink.
Catcpu.sql is run to patch the database.
You have to run catcpu.sql in an upgraded or newly created database from an oracle home where the
CPU patch is applied.
In an upgrade operation run catcpu.sql after running catpatch.sql (for 9i) or catupgrd.sql (for 10G).
For newly created database run catcpu.sql after starting up the database. This is to ensure that the
database vulnerabilities are fixed by making the necessary changes in the dictionary.
To Verify If catcpu.sql has been run against a database run the following:
col action_time for a28
col action for a6
col namespace for a9
col version for a10
col id for 99999999
col comments for a10
select * from registry$history;
e.g.
SQL> col action_time for a28
SQL> col action for a6
SQL> col namespace for a9
SQL> col version for a10
SQL> col id for 99999999
SQL> col comments for a10
SQL> select * from registry$history;
25-APR-08 10.17.22.950000 PM CPU SERVER 10.2.0.3.0 6637239 CPUJAN2008
25-APR-08 10.24.44.233000 PM CPU 6452863 view recom
pilation
Wednesday, May 28, 2008
ORA-38856: Cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled
Example:
In the example below the error Occurred while performing an open resetlogs on a 10.2.0.3 Oracle Single Instance Database
Server prior to restoring an RMAN backup of and Oracle Database. The RMAN backup was taken from a RAC Database Server
and restored to a Single Instance Box.
alter database open resetlogs
*
ERROR at line 1:
ORA-38856: cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled
Details:
ORA-38856: cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled.
Oracle bug, 4355382 ORA-38856: FAILED TO OPEN DATABASE WITH RESETLOGS WHEN USING RAC BACKUP, exists in the
Oracle 10g release 2.0 that affects backups taken from a RAC database. The problem is related to the number of threads
used by the source database and an expectation that the cloned database must have an identical number of threads.
Solution:
1. Set the following parameter in the auxiliary init.ora file: _ no_recovery_through_resetlogs=TRUE.
2. Open the database in resetlogs mode.
3. Remove _ no_recovery_through_resetlogs=TRUE from init.ora.
4. Restart database.
Tuesday, May 20, 2008
ORA-39014
Example:
In the example below the Error Occurred while using data pump expdp to perform a full export on a database.
ORA-39029: worker 1 with process name "DW01" prematurely terminated
ORA-31672: Message 31672 not found; No message file for product=RDBMS, facility=ORA; arguments: [DW01]
Job "SYSTEM"."SYS_EXPORT_FULL_05" stopped due to fatal error at 22:15:39
ORA-39014: One or more workers have prematurely exited.
Details:
This is an Oracle Bug 5879865 Oracle Release 10.2.0.4. Patch 5879865. Fixed in the 11g release.
The problem is due to the query that uses an EXISTS sub-query involving a non-mergeable view causes the core dump.
ORA-39029: worker 1 with process name "DW01" prematurely terminated
ORA-31672: Message 31672 not found; No message file for product=RDBMS, facility=ORA; arguments: [DW01]
Job "SYSTEM"."SYS_EXPORT_FULL_05" stopped due to fatal error at 22:15:39
ORA-39014: One or more workers have prematurely exited.
Solution:
1. If available for your Platform Download Patch 5879865 to resolve this issue.
2. In the meantime, please use one of the following as a workaround:
o "_complex_view_merging" = false
o event="38066 trace name context forever, level 1" or level 2
OR
* set "_optimizer_cost_based_transformation"=off
Tuesday, May 13, 2008
Periodic Job to Purge Perfstat Stats Pack Metrics
Periodic Job to Purge Perfstat Stats Pack Metrics
You can use the following procedure to setup a database job to periodically purge the statspack metrics within
the perfstat schema ever "x" number of days , this can be used as an alternative to sppurge to manage space within
the perfstat schema
As the Perfstat User run create the following procedure
CREATE OR REPLACE PROCEDURE PERFSTAT.USP_SNAPSPURGE (vDAYS NUMBER)
AS
vMIN_SNAP_ID NUMBER;
vMAX_SNAP_ID NUMBER;
vDBID NUMBER;
vDBNAME VARCHAR2(50);
vINST_NUM NUMBER;
vINST_NAME VARCHAR2(50);
vSTIME DATE;
vBTIME VARCHAR2(25);
vETIME VARCHAR2(25);
SQL_STMT VARCHAR2(200);
ERROR_NUM NUMBER;
ERROR_MSG VARCHAR2(500);
BEGIN
select min(snap_id),max(snap_id) into vMIN_SNAP_ID,vMAX_SNAP_ID
from STATS$SNAPSHOT
where snap_time <=(sysdate-vDAYS);
select dbid,name into vDBID,vDBNAME
from v$database;
select instance_number,instance_name into vINST_NUM,vINST_NAME
from v$instance;
select to_char(snap_time, 'YYYYMMDD HH24:MI:SS') into vBTIME
from stats$snapshot b
where b.snap_id = vMIN_SNAP_ID
and b.dbid = vDBID
and b.instance_number = vINST_NUM;
select to_char(snap_time, 'YYYYMMDD HH24:MI:SS') into vETIME
from stats$snapshot e
where e.snap_id = vMAX_SNAP_ID
and e.dbid = vDBID
and e.instance_number = vINST_NUM;
-- **** check variables **** ---
delete from stats$snapshot
where instance_number = vINST_NUM
and dbid = vDBID
and snap_id between vMIN_SNAP_ID and vMAX_SNAP_ID;
SQL_STMT:='alter session set hash_area_size=1048576';
execute immediate (SQL_STMT);
delete --+ index_ffs(st)
from stats$sqltext st
where (hash_value, text_subset) not in
(select --+ hash_aj full(ss) no_expand
hash_value, text_subset
from stats$sql_summary ss
where ( ( snap_id < vMIN_SNAP_ID
or snap_id > vMAX_SNAP_ID
)
and dbid = vDBID
and instance_number = vINST_NUM
)
or ( dbid != vDBID
or instance_number != vINST_NUM)
);
delete --+ index_ffs(sso)
from stats$seg_stat_obj sso
where (dbid, dataobj#, obj#) not in
(select --+ hash_aj full(ss) no_expand
dbid, dataobj#, obj#
from stats$seg_stat ss
where ( ( snap_id < vMIN_SNAP_ID
or snap_id > vMAX_SNAP_ID
)
and dbid = vDBID
and instance_number = vINST_NUM
)
or ( dbid != vDBID
or instance_number != vINST_NUM)
);
delete from stats$undostat us
where dbid = vDBID
and instance_number = vINST_NUM
and begin_time >= to_date(vBTIME, 'YYYYMMDD HH24:MI:SS')
and end_time <= to_date(vETIME, 'YYYYMMDD HH24:MI:SS');
-- delete from stats$undostat us
-- where dbid = vDBID
-- and instance_number = vINST_NUM
-- and begin_time < to_date(vBTIME, 'YYYYMMDD HH24:MI:SS')
-- and end_time > to_date(vETIME, 'YYYYMMDD HH24:MI:SS');
/* Delete any dangling database instance rows for that startup time */
delete from stats$database_instance di
where instance_number = vINST_NUM
and dbid = vDBID
and not exists (select 1
from stats$snapshot s
where s.dbid = di.dbid
and s.instance_number = di.instance_number
and s.startup_time = di.startup_time);
/* Delete any dangling statspack parameter rows for the database instance */
delete from stats$statspack_parameter sp
where instance_number = vINST_NUM
and dbid = vDBID
and not exists (select 1
from stats$snapshot s
where s.dbid = sp.dbid
and s.instance_number = sp.instance_number);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
ERROR_NUM := SQLCODE;
ERROR_MSG := substr(SQLERRM,1,100);
DBMS_OUTPUT.PUT_LINE(ERROR_NUM || ': ' || ERROR_MSG);
END;
/
You can call the above procedure as follows , for example to keep only the only last 30 days of metrics within the
perfstat schema:
SQL> exec PERFSTAT.USP_SNAPSPURGE(30);
As the Perstat User Setup a database job to periodically purge the stats pack schema , for example to purge the statspack
metrics every 31 days , keeping only 30 days worth of metrics:
DECLARE jobno number; BEGIN DBMS_JOB.SUBMIT(job => jobno, what =>
'PERFSTAT.USP_SNAPSPURGE (30);', next_date =>
to_date('14-May-2008 03:00:00 PM','dd-Mon-yyyy HH:MI:SS AM'),
interval => '/*31:Days*/ sysdate + 31'); END;
/
Monday, May 12, 2008
Error Code RMAN-20011: target database incarnation is not current in recovery catalog
RMAN-20011
RMAN-00571: ==============================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ==============================
RMAN-03002: failure of configure command at 05/12/2008 18:21:50
RMAN-06004: ORACLE error from recovery catalog database:
RMAN-20011: target database incarnation is not current in recovery catalog
Details:
The above error occurs when the Database target Incarnation is not current in the Recovery Catalog.
The incarnation of a database is a number that is used to identify a version of the database.
A database incarnation is created whenever you open the database with the RESETLOGS.
V$DATABASE_INCARNATION displays information about all database incarnations. Oracle creates
a new incarnation whenever a database is opened with the RESETLOGS option. Records about the
current and immediately previous incarnation are also contained in the V$DATABASE view.
To Reference the corresponding Incarnation information in the recovery catalog review the
RC_DATABASE_INCARNATION and RC_DATABASE views.
RC_DATABASE_INCARNATION lists information about all database incarnations registered in
the recovery catalog.
RC_DATABASE lists information about the databases registered in the recovery catalog.
It corresponds to the V$DATABASE
view in your target database.
Solution:
Connect to the RMAN schema as rman user e.g.
$ sqlplus rman/rman@RMANREP
SQL> select DBID, NAME, DBINC_KEY, RESETLOGS_CHANGE#, RESETLOGS_TIME
from rc_database_incarnation where dbid=2131079213;
DBID NAME DBINC_KEY RESETLOGS_CHANGE# RESETLOGS
---------- -------- ---------- ----------------- ---------
2131079213 DATABASE 1274431 80473525 20-JUN-07
2131079213 DATABASE 1274433 80251948 18-JUN-07
Connect to the RMAN catalog from the target databse
$ rman catalog rman/rman@RMANREP target sys/manager@DATABASE
Reset the database to the latest incarnation
RMAN> reset database to incarnation 1274431;
database reset to incarnation 1274431
Resync the catalog
RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete
Verify all changes
RMAN> list incarnation;
starting full resync of recovery catalog
full resync complete
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1274430 1274433 DATABASE 2131079213 PARENT 80251948 18-JUN-07
1274430 1274431 DATABASE 2131079213 CURRENT 80473525 20-JUN-07
Wednesday, April 9, 2008
Hidden Oracle Parameter 9i/10g
rem -----------------------------------------------------------------------
rem Filename: hidden_parameters.sql
rem Purpose: List all Hidden Oracle Parameter when using spfile with 9i/10g rem -----------------------------------------------------------------------
SELECT
a.ksppinm "Parameter",
b.ksppstvl "Session Value",
c.ksppstvl "Instance Value"
FROM
x$ksppi a,
x$ksppcv b,
x$ksppsv c
WHERE
a.indx = b.indx
AND
a.indx = c.indx
AND
a.ksppinm LIKE '/_%' escape '/' /
Wednesday, March 19, 2008
MSTSC
a remote client or server. Essentially you can connect to the desk top of another Windows based client or desktop which has Remote
Desktop enabled.
- Right click on "My Computer"
- Click on the "Remote" Tab
- Check "All users to connect remotely to this computer"
as follow:
Go to Start , Run and type the following:
mstsc -v:<servername> /F -console
This will connect you to the server and if the session is terminated any running process from this session will not be terminated.
Running the following
mstsc <servername>
Will connect you to the server and if the session is terminated any running process from this session will be terminated also.
Parameters
Sunday, March 16, 2008
Oracle Database Procedures
Resize Listener Log File | Alter session set current_schema | Identify Duplicate Rows in a Table |
Delete Logfiles under Windows | Change Database DBID | |
Procedure to Resize Listener Log File
The following procedure details how to resize the listener log file. In this procedure we
perform the following
- Set the listener process to stop logging to the listener log file.
- Rename the listener.log file to a new name.
- Set the listener process to start logging to the listener log file.
The listener process will create a new log file , this will allow you to archive off the
old listerner log file which can often help resolve file system space issues where
the listener log file has grown to an unmanageable size.
Unix
# lsnrctl set Log_status off
# mv listener.log to listener.log.old
# lsnrctl set Log_Status on
Windows
C:> lsnrctl set Log_status off
C:> move listener.log to listener.log.old
C:> lsnrctl set Log_Status on
Example
C:oracleproduct9inetworklog>lsnrctl set log_status off
LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 16-MAR-2008 21:51:
18
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
LISTENER parameter "log_status" set to OFF
The command completed successfully
C:oracleproduct9inetworklog>move listener.log listener.log.old
C:oracleproduct9inetworklog>lsnrctl set log_status on
LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 16-MAR-2008 21:53:
10
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
LISTENER parameter "log_status" set to ON
The command completed successfully
Note: It is important not to rename or delete the listener log file without setting the
"log_status" to off. In the event that you rename or delete the listener log file
without setting the listener log_status to off , the listener will stop logging to the
listener log file. To resolve such an issue where the listener is no longer logging to
the listener log file set the log_status to off , and then set the log_status to on.
e.g.
# lsnrctl set Log_status off
# lsnrctl set Log_Status on
Friday, March 14, 2008
Error Code RMAN-06026: error reading backup piece
restoring datafile 00171 to H:\SYSTEM04.DBF
channel ORA_DISK_1: reading from backup piece K:BACKUPE1J96QQG_1_1.BAK
ORA-19870: error reading backup piece K:BACKUPE1J96QQG_1_1.BAK
ORA-19612: datafile 70 not restored due to missing or corrupt data
failover to previous backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/04/2008 18:48:23
RMAN-06026: some targets not found - aborting restore
Details:
The above error occurred as a result of trying to restore a database using
RMAN> restore database;
A validate of the backup set showed that the backup set was corrupt
RMAN> validate backupset 3669
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece K:BACKUPE1J96QQG_1_1.BAK
channel ORA_DISK_1: restored backup piece 1
piece handle=K:BACKUPE1J96QQG_1_1.BAK tag=TAG20080220T151208
channel ORA_DISK_1: validation complete, elapsed time: 00:07:06
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/04/2008 19:58:14
ORA-19660: some files in the backup set could not be verified
ORA-19661: datafile 70 could not be verified
Solution:
The RMAN backup set is corrupt and you be unable to use the backup set.
To resolve the issue , take another RMAN backup and validate all backup sets.
To get a list of all backup sets
RMAN > list backupsets;
RMAN > validate backupset ;
Error Code RMAN-06059 : expected archived log not found
Starting backup at 29-NOV-07
current log archived
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 11/29/2007 04:49:58
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file E:DATABASESEDILARCHIVEARC88454.1
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
RMAN>
Recovery Manager complete.
Details:
Rman backup failing due to missing archive logs
Solution:
On the database being backed up cross check your archive logs and initiate another backup
RMAN > crosscheck archivelog all;
If you still experience issues with the above RMAN-06059 errors you can take a more agressive
approach to clean up your archive logs , ensure you have a backup of all archive logs prior to
the following solution
RMAN> crosscheck copy of archivelog all;
RMAN> crosscheck archivelog all;
RMAN> resync catalog;
RMAN> delete force obsolete;
RMAN> delete expired archive all;
Oracle Database Scripts
Oracle Database Scripts - Structure
Oracle Database Uptime
rem Filename: uptime.sql
rem Purpose: Report Database Uptime
rem -----------------------------------------------------------------------
set heading off
select
'Hostname : ' || host_name,
'Instance Name : ' || instance_name,
'Started At : ' || to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') stime,
'Uptime : ' || floor(sysdate - startup_time) || ' days(s) ' ||
trunc( 24*((sysdate-startup_time) -
trunc(sysdate-startup_time))) || ' hour(s) ' ||
mod(trunc(1440*((sysdate-startup_time) -
trunc(sysdate-startup_time))), 60) ||' minute(s) ' ||
mod(trunc(86400*((sysdate-startup_time) -
trunc(sysdate-startup_time))), 60) ||' seconds' uptime
from sys.v_$instance
/
Percentage Free Space Available
rem Filename: ts_freespace.sql
rem Purpose: Reports Percentage Tablespace Freespace Available
rem -----------------------------------------------------------------------
CLEAR
SET HEAD ON
SET VERIFY OFF
spool frt1
col tspace form a25 Heading "Tablespace"
col tot_ts_size form 99999999999999 Heading "Size (Mb)"
col free_ts_size form 99999999999999 Heading "Free (Mb)"
col ts_pct form 9999 Heading "% Free"
col ts_pct1 form 9999 Heading "% Used"
break on report
compute sum of free_ts_size on report
compute sum of tot_ts_size on report
SELECT /* + RULE */ df.tablespace_name tspace,
df.bytes/(1024*1024) tot_ts_size,
sum(fs.bytes)/(1024*1024) free_ts_size,
nvl(round(sum(fs.bytes)*100/df.bytes),1) ts_pct,
round((df.bytes-sum(fs.bytes))*100/df.bytes) ts_pct1
FROM dba_free_space fs
, (select tablespace_name, sum(bytes) bytes
from dba_data_files group by tablespace_name ) df
WHERE fs.tablespace_name(+) = df.tablespace_name
GROUP BY df.tablespace_name, df.bytes
union all
SELECT /* + RULE */
df.tablespace_name tspace,
fs.bytes/(1024*1024) tot_ts_size,
sum(df.bytes_free)/(1024*1024) free_ts_size,
nvl(round((sum(fs.bytes)- df.bytes_used) *100/fs.bytes),1) ts_pct,
round((sum(fs.BYTES) - df.BYTES_free )*100/fs.bytes) ts_pct1
FROM dba_temp_files fs
, (select tablespace_name, bytes_free, bytes_used
from V$temp_space_header
group by tablespace_name, bytes_free, bytes_used ) df
WHERE fs.tablespace_name(+) = df.tablespace_name
GROUP BY df.tablespace_name, fs.bytes, df.bytes_free,df.BYTES_used
order by 4 desc
/
spool off