Wednesday, October 17, 2012

Applying Oracle Critical Patch - CPU

Follow these steps:

Assume that we are in a single instance (Not RAC), shut down all instances and listeners associated with the Oracle home that you
are updating.

Ensure that the $PATH has the following executables: make, ar, ld, and nm.
The location of these executables depends on your operating system. On many operating systems, they are
located in /usr/ccs/bin, in which case you can set your PATH as follows:

export PATH=$PATH:/usr/ccs/bin
or
export PATH=$PATH:$ORACLE_HOME/OPatch


Set your current directory to the directory where the patch is located and then run the OPatch utility by entering
the following commands:
unzip p14390377_112020_.zip
cd 14390377

Then run

opatch napply -skip_subset -skip_duplicate

After installing succefully check

opatch lsinventory

You can see the latest patch versions updated

connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script as follows:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql cpu apply
SQL> QUIT

If catbundle is not recognizing run it with the path

SQL > @?/rdbms/admin/catbundle.sql cpu apply

Finally check the below path for any errors

catbundle_CPU__APPLY_.log
catbundle_CPU__GENERATE_.log

References
https://updates.oracle.com/Orion/Services/download?type=readme&aru=15433726#CHDCBBFE

Monday, October 8, 2012

Recovering from Missed /Deleted dbf file in Oracle

Scenerio- one or more datafiles are deleted from OS level and databae is not geeting open. Issue SQL> startup ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance ORACLE instance started. Total System Global Area 534462464 bytes Fixed Size 2215064 bytes Variable Size 390071144 bytes Database Buffers 134217728 bytes Redo Buffers 7958528 bytes Database mounted. ORA-01157: cannot identify/lock data file 8 - see DBWR trace file ORA-01110: data file 8: '/u01/app4/oracle/oradata/uatdb3/rman_tbs02.dbf' Solution SQL> alter database datafile '/u01/app4/oracle/oradata/uatdb3/rman_tbs02.dbf' offline drop; Database altered. SQL> alter database backup controlfile to trace as '/u01/app/test.ctl'; Database altered. SQL> alter database open 2 ; Database altered.

Tuesday, August 14, 2012

Recovering from corrupted control file

SQL> startup;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 3340451840 bytes
Fixed Size                  2231088 bytes
Variable Size            2516583632 bytes
Database Buffers          805306368 bytes
Redo Buffers               16330752 bytes
ORA-00205: error in identifying control file, check alert log for more info

Connect to RMAN Target and try to recover from backup control file


RMAN> restore controlfile from '/u02/backups/cfc-4050291476-20120814-01';

Starting restore at 14-AUG-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/imalmock/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/imalmock/control02.ctl
Finished restore at 14-AUG-12

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> show all;

RMAN configuration parameters for database with db_unique_name IMALMOCK are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backups/cf%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/backups/rmancits1_%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_imalmock.f'; # default

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/14/2012 14:28:51
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/14/2012 14:29:17
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/imalmock/system01.dbf'

RMAN> restore database;

Starting restore at 14-AUG-12
Starting implicit crosscheck backup at 14-AUG-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
Crosschecked 10 objects
Finished implicit crosscheck backup at 14-AUG-12

Starting implicit crosscheck copy at 14-AUG-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 14-AUG-12

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/imalmock/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/imalmock/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/imalmock/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/imalmock/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/imalmock/example01.dbf


[oracle@imalmock bin]$ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue Aug 14 14:50:25 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: IMALMOCK (DBID=4050291476, not open)

RMAN> recover database;

Starting recover at 14-AUG-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

starting media recovery

archived log for thread 1 with sequence 1120 is already on disk as file /u01/app/oracle/oradata/imalmock/redo8.log
archived log file name=/u01/app/oracle/oradata/imalmock/redo8.log thread=1 sequence=1120
media recovery complete, elapsed time: 00:00:04
Finished recover at 14-AUG-12

RMAN> exit


Recovery Manager complete.
[oracle@imalmock bin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Aug 14 14:50:44 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 3340451840 bytes
Fixed Size                  2231088 bytes
Variable Size            2516583632 bytes
Database Buffers          805306368 bytes
Redo Buffers               16330752 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL>

RMAN> alter database open resetlogs;

using target database control file instead of recovery catalog
database opened

RMAN>


Now the restore process is finish

Wednesday, February 22, 2012

Switch over from Primary to Standby in Oracle 11 G RAC

From Primary DB
SQL> select THREAD#, max(SEQUENCE#) from v$archived_log group by THREAD#;

THREAD# MAX(SEQUENCE#)
---------- --------------
1 724
2 252

From Standby DB
SQL> select THREAD#, max(SEQUENCE#) from v$archived_log where APPLIED='YES' group by THREAD#;

THREAD# MAX(SEQUENCE#)
---------- --------------
1 724
2 251


Primary and Standby archivelog sequences should be same , other wise we have to manual copy them or resync

From Primary DB

DGMGRL> switchover to primay_db_name
Performing switchover NOW, please wait...
New primary database "standby_db" is opening...
Operation requires shutdown of instance "primay_db_name" on database "primay_db_name"
Shutting down instance "primay_db"...
ORA-01031: insufficient privileges

Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
shut down instance "primay_db_name" of database "primay_db_name"
start up and mount instance "primay_db_name" of database "primay_db_name"

DGMGRL>

From Primary DB
[oracle@primay_db_server ~]$ srvctl stop database -d primay_db_name
[oracle@primay_db_server ~]$ srvctl start database -d primay_db_name -o mount


[oracle@standby_db_server ~]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration

Configuration - standby_db

Protection Mode: MaxPerformance
Databases:
standby_db - Primary database
iprimary_db - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Wednesday, January 11, 2012

Adding Datafiles to tablespaces

[oracle@1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 11 07:45:51 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit

Production
With the Partitioning, Real Application Clusters, Automatic Storage

Management, OLAP,
Data Mining and Real Application Testing options

SQL> select distinct owner from dba_segments where

tablespace_name='USERS';

OWNER
------------------------------

EX_DEV1
SCOTT
AUDITOR


SQL> select file_name,bytes/1024/1024 from dba_data_files where

tablespace_name=

'USERS';

FILE_NAME
-------------------------------------------------------------------

-------------
BYTES/1024/1024
---------------
+DATA01/im/datafile/users.259.760022883
29880


SQL> alter tablespace users add datafile '+DATA01' size 2000M;

Tablespace altered.

SQL> select file_name,bytes/1024/1024 from dba_data_files where

tablespace_name

='USERS';

FILE_NAME
-------------------------------------------------------------------

-------------
BYTES/1024/1024
---------------
+DATA01/im/datafile/users.259.760022883
29880

+DATA01/im/datafile/users.282.772271427
2000


SQL> select file_name,bytes/1024/1024 from dba_data_files where

tablespace_name

='SYSTEM';

FILE_NAME
-------------------------------------------------------------------

-------------
BYTES/1024/1024
---------------
+DATA01/im/datafile/system.256.760022881
940


SQL> alter tablespace system add datafile '+DATA01' size 2000M;

Tablespace altered.

SQL> select file_name,bytes/1024/1024 from dba_data_files where

tablespace_name=

'SYSTEM';

FILE_NAME
-------------------------------------------------------------------

-------------
BYTES/1024/1024
---------------
+DATA01/im/datafile/system.256.760022881
940

+DATA01/im/datafile/system.283.772271543
2000


SQL> exit

TCP/IP vulnerabilities and various TCP and UDP port numbers

Overlapping IP fragments

This exploit alter the code from the teardrop attack to include the use of a SYN sequence bug. The attack will launch two IP fragments, through the offset of the second piece inside the prior packet's consignment that overlaps but does not include sufficient payloads to complete the datagram

Teardrop Attack

IP needs a packet that is too big for the next router to handle be separated into fragments. The attacker's IP puts a puzzling offset value in the second or afterward fragment.

If the getting operating system is not able to combine the packets consequently, it can collapse the system.

The Unnamed Attack

Deviation of Teardrop attack. Fragments are not overlapping; as an alternative there are gaps included. Watchfully plan of the algorithm for generating these early sequence numbers ensures that overlie in sequence number gap between different incarnations of a link is prevented

SYN Attack

The attacker sends fake TCP SYN requests to a wounded server. The host allocates memory sockets for the connection. It avoids the server from responding to lawful requests. This assault exploits the three-way handshake. Malicious flooding by huge volumes of TCP SYN packets to the injured party system with spoofed source IP addresses can reason DoS.

Port Number Protocol

21 TCP FTP (File Transfer Protocol)

22 TCP/UDP SSH (ssh,scp copy or sftp)

23 TCP/UDP Telnet

25 TCP/UDP SMTP (for sending outgoing emails)

43 TCP WHOIS function

53 TCP/UDP DNS Server (Domain name service for DNS requests)

70 TCP Gopher Protocol

79 TCP Finger protocol

110 TCP POP3 (for receiving email)

119 TCP NNTP (Network News Transfer Protocol)

143 TCP/UDP IMAP4 Protocol (for email service)

194 TCP IRC

389 TCP/UDP LDAP (light weight directory access)

443 TCP Secure HTTP over SSL (https)

465 TCP Secure SMTP (email) using SSL

990 TCP/UDP Secure FTP using SSL

993 TCP Secure IMAP protocol over SSL (for emails)

1433 TCP/UDP Microsoft SQL server port

2082 TCP Cpanel default port

2083 TCP Cpanel over SSL

2086 TCP Cpanel Webhost Manager (default)

2087 TCP Cpanel Webhost Manager (with https)

2095 TCP Cpanel Webmail

2096 TCP Cpanel secure webmail over SSL

2222 TCP DirectAdmin Server Control Panel