Sunday, February 28, 2016

e2fsck: Cannot continue, aborting in linux





Step 1: mount the root file system read,write mode using below command

mount  / -o remount,rw

Step 2:

Try fsck command to recover 

Remove the file system from /etc/fstab file and restart system

Example:

/dev/sdd1 => 

init 6

Saturday, February 27, 2016

How to Upgrade Oracle Database 11.2.0.1 to 11.2.0.4 ?

Upgrade Oracle Database 11g
=================================================
===============


Database upgrade important part of DBA life . So when doing upgrade database we make note some important point :-

1. Verify all the prerequisite h/w  and s/w  for target version .
2. Use out of place upgrade method (recommended by oracle  ) 
3. Take backup of existing database which going to upgrade and  keep backup  if possible on another     server (mount point  like /bkp)
   use RMAN (Recovery manager) to take full  backup of database 





 Step 1:
============

Download Software from Oracle site.

Oracle Database (includes Oracle Database and Oracle RAC)
Note: you must download both zip files to install Oracle Database.
p13390677_112040_platform_1of7.zip
p13390677_112040_platform_2of7.zip
Oracle Grid Infrastructure (includes Oracle ASM, Oracle Clusterware, and Oracle Restart)p13390677_112040_platform_3of7.zip
Oracle Database Clientp13390677_112040_platform_4of7.zip
Oracle Gatewaysp13390677_112040_platform_5of7.zip
Oracle Examplesp13390677_112040_platform_6of7.zip
Deinstallp13390677_112040_platform_7of7.zip


We need for Database:


p13390677_112040_platform_1of7.zipp13390677_112040_platform_2of7.zip


After unzip  the downloaded software :-

unzip  p13390677_112040_platform_1of7.zip
unzip p13390677_112040_platform_2of7.zip




Step 2:
==================

Click on runInstaller and install software  with new oracle home 





Step 3:
=================
After  software install  run pre-check before upgrade on running database using new oracle home  run the prerequisite script


SQL> @/u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin/utlu112i.sql



SQL> !pwd
/u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin

SQL> @/u01/app/oracle/product/11.2.0.4/db_1/rdbms/admin/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 02-27-2016 19:03:18
Script Version: 11.2.0.4.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name:          FINAL
--> version:       11.2.0.1.0
--> compatible:    11.2.0.0.0
--> blocksize:     8192
--> platform:      Linux x86 64-bit
--> timezone file: V11
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 878 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 497 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.

--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.

**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views         [upgrade]  VALID
--> Oracle Packages and Types    [upgrade]  VALID
--> JServer JAVA Virtual Machine [upgrade]  VALID
--> Oracle XDK for Java          [upgrade]  VALID
--> Oracle Workspace Manager     [upgrade]  VALID
--> OLAP Analytic Workspace      [upgrade]  VALID
--> OLAP Catalog                 [upgrade]  VALID
--> Oracle Text                  [upgrade]  VALID
--> Oracle XML Database          [upgrade]  VALID
--> Oracle Java Packages         [upgrade]  VALID
--> Oracle interMedia            [upgrade]  VALID
--> Spatial                      [upgrade]  VALID
--> Expression Filter            [upgrade]  VALID
--> Rule Manager                 [upgrade]  VALID
--> Oracle Application Express   [upgrade]  VALID
... APEX will only be upgraded if the version of APEX in
... the target Oracle home is higher than the current one.
--> Oracle OLAP API              [upgrade]  VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database is using a timezone file older than version 14.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 11.2.0.1.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
        PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> Database contains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 has dependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:

    EXECUTE dbms_stats.gather_dictionary_stats;

**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.

To view existing non-default events execute the following commands
while connected AS SYSDBA:
  Events:
    SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
      WHERE  UPPER(name) ='EVENT' AND  isdefault='FALSE'

  Trace Events:
    SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
      WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'

Changes will need to be made in the init.ora or spfile.

**********************************************************************
SQL>

In  above output all component all valid state and check all recommendation by this script

Check db must be running using spfile



-------------------------
Set the display 

export DISPLAY=yourip :0.0
then run xclock its show popup 

Run the ./runinstaller  from command prompt



We skip this step click on netxt


We not provide support email id then show the error ignore this error click on yes


select Skip software and click on next


For upgrade select install database software only then click on next


As per  environment we select type of database 
In my case stand alone single instance database so we select single instance database installation then click on next 



select the language as  per requirement in my case is English then click on next



Choose  which database edition need to install in my case choose Enterprise Edition
then click on next



Define the Oracle Base and Software directory here we careful  when give directory locations
then click on next

we use new home here
/u01/app/oracle/product/11.2.0/db_1/



Select group then click on next


check prerequisite must be check all package are install and meet software requirement
then click on next


In my case swap alert i am ignore all here but  must be validate in environment
Then click on next


Check all parameter which you give before  parameter you define validate then click next


Here software is almost install then popup  on execute Root Script

We login from root user and run script show on popup
after successful  run root.sh click on ok .


then click on close


This stage software installation done we start upgrade database 

Start Upgrade database
====================


We set some env. variable 
set ORACLE_HOME new oracle oracle home which we install 
set display
$export DISPLAY=yourip:0.0
check umask value should be 022
cd u01/app/oracle/product/11.2.0/db_1//bin

and run ./dbua
check =>umask 022
check =>xclock
Execute dbua from new oracle home


click on next

Here we select which database need to be upgrade then click on next




Check here warning then click on next


Here select appropriate value and degree of parallelism  as per env. here we take 1

if you upgrade time zone tick on timezone  dbua also recommend to take backup if need then ypu specify backup location then click on next




Here choose do not move database files as Part of upgrade

if you move file system to ASM so choose as per requirement
then click on next








check  report after upgrade report all components are show successful .

then you login the database from new ORACLE_HOME

check the /etc/oratab file

change .profile in unix/aix .bash_profile in linux set new oracle home location


Enjoy!!!

ORA-23515: materialized views and/or their indices exist in the tablespace


Make list of  MATERIALIZED  view:
===================================


select 'drop materialized view  '|| a.owner||'.'|| a.object_name || ';' from dba_objects a ,dba_segments b where a.OWNER=b.OWNER and b.TABLESPACE_NAME='MGMT_TABLESPACE'  and object_type='MATERIALIZED VIEW';
drop materialized view SYSMAN.MGMT$ARU_PATCH_RECOM_MD;

ORA-24005: Inappropriate utilities used to perform DDL on AQ table

SQL> drop table SYSMAN.MGMT_LOADER_QTABLE cascade constraints;
                  *
ERROR at line 1:
ORA-24005: Inappropriate utilities used to perform DDL on AQ table SYSMAN.MGMT_LOADER_QTABLE





execute DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'SYSMAN.MGMT_NOTIFY_INPUT_QTABLE', force => true);

select 'execute DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => ' ||owner||'.'||table_name||' , force => true) ;' from dba_LOBS WHERE TABLESPACE_NAME='MGMT_TABLESPACE';

Deleted Central Inventory : Re - Create Inventory in Oracle 11gr2

Login As Oracle user

su - oracle

[oracle@test~]$
[oracle@test~]$
[oracle@test~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@test~]$ echo $ORACLE_SID
TEST
[oracle@test~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@test~]$



[oracle@test bin]$
[oracle@test bin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/oui/bin
[oracle@test bin]$
[oracle@test bin]$ ls
addLangs.sh  attachHome.sh  filesList.bat         filesList.sh  resource      runInstaller     runSSHSetup.sh
addNode.sh   detachHome.sh  filesList.properties  lsnodes       runConfig.sh  runInstaller.sh
[oracle@test bin]$
[oracle@test bin]$
[oracle@test bin]$
[oracle@test app]$ ls
Make  oraInventory  oraInventory_old
[oracle@test app]$ ls
oracle    oraInventory_old
[oracle@test app]$
[oracle@test app]$
[oracle@test app]$

=======Attach Oracle Home=================

[oracle@test bin]$ ./runInstaller -silent -attachHome -invPtrLoc /etc/oraInst.loc oracle_home="/u01/app/oracle/product/11.2.0/db_1" ORACLE_HOME_NAME="OraDb11g_home1"
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 2999 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-02-27_11-46-02AM. Please wait ...[oracle@test bin]$ The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'AttachHome' was successful.

[oracle@test bin]$
[oracle@test bin]$
[oracle@test bin]$


====================Attach Grid Home=======================

Login as grid user

su - grid


[grid@e@test ~] cd /u01/app/11.2.0/grid/oui/bin/

[grid@e@test bin ~]$ ./runInstaller -silent -attachHome -invPtrLoc /etc/oraInst.loc oracle_home="/u01/app/oracle/11.2.0/grid" ORACLE_HOME_NAME="Ora11g_gridinfrahome1" 
Starting Oracle Universal Installer…
Checking swap space: must be greater than 500 MB.   Actual 2999 MB    Passed 
The inventory pointer is located at /etc/oraInst.loc 
The inventory is located at /u01/app/oraInventory 
‘AttachHome’ was successful.

Monday, February 22, 2016

Create Database using DBCA in 11gr2


CREATE DATABASE USING DBCA
===========================================================
==============================
=================


Login as oracle user

[oracle@test ~]$ dbca
or
[oracle@test ~]$ cd /u01/app/oracle/product/11.2.0/db_1/bin
[oracle@test ~]$ ./dbca



















Add Harddisk in linux as mount point /u01 using Virtual Box

ADD HARD DISK IN LINUX USING VIRTUAL BOX
====================================================================
=======================================================
=============================== 











Login as ROOT user
===================================

[root@test ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root  8.3G  5.1G  2.8G  65% /
tmpfs                        2.0G   76K  2.0G   1% /dev/shm
/dev/sda1                    477M   55M  397M  13% /boot
/dev/sdb1                    9.8G  3.7G  5.6G  40% /repo
[root@test ~]#
[root@test ~]#
[root@test ~]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00095f55

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1567    12069888   8e  Linux LVM

Disk /dev/sdb: 10.8 GB, 10766991360 bytes
255 heads, 63 sectors/track, 1309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc71cec29

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1309    10514511   83  Linux

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_test-lv_root: 9122 MB, 9122611200 bytes
255 heads, 63 sectors/track, 1109 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_test-lv_swap: 3145 MB, 3145728000 bytes
255 heads, 63 sectors/track, 382 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@test ~]#
[root@test ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x9595adae.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9595adae

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566

Command (m for help): p

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9595adae

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1566    12578863+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@test ~]#
[root@test ~]#
[root@test ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3144715 blocks
157235 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@test ~]#
[root@test ~]# cd /
[root@test /]# mkdir /u01
[root@test /]#
[root@test /]# mount -t ext4 /dev/sdc1 /u01
[root@test /]#
[root@test /]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root  8.3G  5.1G  2.8G  65% /
tmpfs                        2.0G   76K  2.0G   1% /dev/shm
/dev/sda1                    477M   55M  397M  13% /boot
/dev/sdb1                    9.8G  3.7G  5.6G  40% /repo
/dev/sdc1                     12G   30M   12G   1% /u01
[root@test /]#
[root@test /]# vi /etc/fstab
[root@test /]#
[root@test /]# cat etc/fstab

#
# /etc/fstab
# Created by anaconda on Sun Feb 21 22:08:33 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_test-lv_root /                       ext4    defaults        1 1
UUID=2f39e521-c679-45a8-899b-3e4facdb6fd7 /boot                   ext4    defaults        1 2
/dev/mapper/vg_test-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1               /repo                   ext4    defaults        1 2
/dev/sdc1               /u01                    ext4    defaults        1 2
[root@test /]#