Mstsc (Remote Desktop Client) | | |
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
List User Processes
rem Filename: list_user_process.sql
rem Purpose: List User Processes
rem -----------------------------------------------------------------------
set heading off
set feedback off
set pagesize 0
set lines 200
select to_char(sysdate,'HH24:MI:ss'),pid, spid, username, program, serial# from v$process
/
Wednesday, March 12, 2008
Check Which Constraints Are Not Enabled
rem Filename: constraints_not_enabled_check.sql
rem Purpose: Check which Database Constraints are not Enabled
rem -----------------------------------------------------------------------
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
col owner format a10
col column_name format a30
set linesize 132
select a.last_change,a.constraint_type,b.owner,b.constraint_name,b.table_name,b.column_name
from user_constraints a,user_cons_columns b
where a.constraint_name = b.constraint_name
and a.status != 'ENABLED';