Showing posts with label RedHat. Show all posts
Showing posts with label RedHat. Show all posts

Tuesday, December 16, 2014

ORACLE - ORATOP

oratop - Utility for Near Real-time Monitoring of Databases, RAC and Single Instance (Doc ID 1500864.1)


oratop: Release 14.1.2
Usage: 
oratop [ [Options] [Logon] ]

Logon:
{username[/password][@connect_identifier] | / }
[AS {SYSDBA|SYSOPER}]

connect_identifier:
    o Net Service Name, (TNS) or
    o Easy Connect (host[:port]/[service_name])
Options:
    -d : real-time (RT) wait events, section 3 (default is Cumulative)
    -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH)
    -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM)
    -s : SQL mode, section 4 (default is process mode)
    -c : database service mode (default is connect string) 
    -f : detailed format, 132 columns (default: standard, 80 columns)
    -b : batch mode (default is text-based user interface)
    -n : maximum number of iterations (requires number)
    -i : interval delay, requires value in seconds (default: 5s)
    -v : oratop release version number
    -h : this help


[root@cacti tmp]# ./oratop.RDBMS_11.2_LINUX_X64 siltech/siltech@xe -f -s
Oracle 11g - Primary XE     09:10:05 up: 4.9d,   1 ins,    1 sn,   1 us, 561M mt,    4% fra,   0 er,                      17.1% db
ID %CPU LOAD %DCU   AAS  ASC  ASI  ASW  ASP  AST  UST MBPS IOPS IORL LOGR PHYR PHYW  %FR   PGA TEMP UTPS UCPS SSRT DCTR DWTR  %DBT
 1   23    0   19   0.7    2    0    0    0    2    2    0   40  42u  15k    0    0   96   63M  13M    0  141 244u  116    0   100

EVENT (C)                                                         TOTAL WAITS   TIME(s)  AVG_MS  PCT                    WAIT_CLASS
DB CPU                                                                             4580           59                              
resmgr:cpu quantum                                                     144969      2211    15.3   28                     Scheduler
log file parallel write                                                249928       414     1.7    5                    System I/O
log file sync                                                          186382       408     2.2    5                        Commit
control file parallel write                                            151533       211     1.4    3                    System I/O

ID  USERNAME  MODULE   ACTION  SQL_ID          SQL_TEXT               X  ELAP  CPUT  IOWT  WAIT  EXEC  ROWS  BUFG  DISK  BH%  LOAD
 1  LAURA     perl@ca          74vma1wu3pf7w   select * from all_tab  S   26m   25m    3u     0  4.3k   119   862     0  100     1

[root@cacti ~]# su - oracle
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Dec 16 09:23:58 2014

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


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


SQL> select sql_text from v$sql where sql_id='74vma1wu3pf7w' union select username from v$session where sql_id='74vma1wu3pf7w';


SQL_TEXT
------------------------------------------------------------------------------------------------------------------------
LAURA
select * from all_tables


SQL> /





[oracle@orasrvteste ]$ ./oratop.RDBMS_11.2_LINUX_X64 -h
./oratop.RDBMS_11.2_LINUX_X64: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
[oracle@orasrvteste lib]$ cd $ORACLE_HOME/lib
[oracle@orasrvteste lib]$export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
[oracle@orasrvteste lib]$ ll libclntsh.so*
lrwxrwxrwx 1 oracle oinstall       17 May 14  2010 libclntsh.so -> libclntsh.so.10.1
-rwxrwx--- 1 oracle oinstall 20651386 May 14  2010 libclntsh.so.10.1
[oracle@orasrvteste lib]$ cp libclntsh.so.10.1 libclntsh.so.11.1
[oracle@orasrvteste lib]$ oratop.RDBMS_11.2_LINUX_X64 -h
oratop: Release 14.1.2
Usage:
         oratop [ [Options] [Logon] ]

         Logon:
                {username[/password][@connect_identifier] | / }
                [AS {SYSDBA|SYSOPER}]

                connect_identifier:
                     o Net Service Name, (TNS) or
                     o Easy Connect (host[:port]/[service_name])
         Options:
             -d : real-time (RT) wait events, section 3 (default is Cumulative)
             -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH)
             -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM)
             -s : SQL mode, section 4 (default is process mode)
             -c : database service mode (default is connect string)
             -f : detailed format, 132 columns (default: standard, 80 columns)
             -b : batch mode (default is text-based user interface)
             -n : maximum number of iterations (requires number)
             -i : interval delay, requires value in seconds (default: 5s)
             -v : oratop release version number
             -h : this help

[oracle@orasrvteste lib]$

Thursday, December 11, 2014

ORACLE - ORA-00205: error in identifying control file

[root@cacti XE]# su - oracle
-bash-4.1$ ls
admin  connect  diag  exit  fast_recovery_area  oradata  oradiag_oracle  product
-bash-4.1$ cd oradata/
-bash-4.1$ cd XE/
-bash-4.1$ ls
control.dbf  sysaux.dbf  system.dbf  temp.dbf  undotbs1.dbf  users.dbf
-bash-4.1$ ll
total 1285700
-rw-r-----. 1 oracle dba   9748480 Dec 10 07:11 control.dbf
-rw-r-----. 1 oracle dba 744497152 Dec 10 07:10 sysaux.dbf
-rw-r-----. 1 oracle dba 377495552 Dec 10 07:10 system.dbf
-rw-r-----. 1 oracle dba  20979712 Dec  9 22:00 temp.dbf
-rw-r-----. 1 oracle dba  78651392 Dec 10 07:05 undotbs1.dbf
-rw-r-----. 1 oracle dba 104865792 Dec  8 12:41 users.dbf
-bash-4.1$ pwd
/u01/app/oracle/oradata/XE
-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 11 10:47:30 2014

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


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

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info


SQL> alter system set control_files='/u01/app/oracle/oradata/XE/control.dbf' scope=spfile;

System altered.

SQL> startup force;
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size     2228080 bytes
Variable Size   322961552 bytes
Database Buffers   192937984 bytes
Redo Buffers     3809280 bytes
Database mounted.
Database opened.

SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
HOST_NAME
----------------------------------------------------------------
VERSION   STARTUP_T STATUS PAR THREAD# ARCHIVE LOG_SWITCH_WAIT
----------------- --------- ------------ --- ---------- ------- ---------------
LOGINS   SHU DATABASE_STATUS INSTANCE_ROLE     ACTIVE_ST BLO EDITION
---------- --- ----------------- ------------------ --------- --- -------
      1 XE
cacti.siltechconsult.com.br
11.2.0.2.0   11-DEC-14 OPEN NO       1 STOPPED
ALLOWED    NO  ACTIVE PRIMARY_INSTANCE   NORMAL    NO  XE



SQL> 

Wednesday, December 10, 2014

ORACLE - ADD DISK ASM/Diskgroup - Automatic Storage Management (ASM)

Automatic Storage Management (ASM)

login as: root
root@192.168.0.239's password:
Last login: Tue Dec  9 19:10:42 2014 from 192.168.0.206
[root@db1 ~]# fdisk -l

Disk /dev/sda: 150.3 GB, 150323855360 bytes
255 heads, 63 sectors/track, 18275 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: 0x000dc94c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        4203    33554432   82  Linux swap / Solaris
/dev/sda3            4203        9303    40960000   83  Linux
/dev/sda4            9303       18276    72080384    5  Extended
/dev/sda5            9303       18276    72079360   83  Linux

Disk /dev/sdc: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x90a18a8c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        6527    52428096   83  Linux

Disk /dev/sdd: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x3a45183b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        6527    52428096   83  Linux

Disk /dev/sde: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0xde587821

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1        6527    52428096   83  Linux

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x50b618df

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        6527    52428096   83  Linux

Disk /dev/sdf: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x2932987d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1        6527    52428096   83  Linux

Disk /dev/sdh: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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/sdg: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 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: 0xbe2c0835

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       26108   209712478+  83  Linux
[root@db1 ~]# fdisk -l /dev/sdh

Disk /dev/sdh: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 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@db1 ~]# cat /proc/partitions
major minor  #blocks  name

   2        0          4 fd0
  11        0    1048575 sr0
   8        0  146800640 sda
   8        1     204800 sda1
   8        2   33554432 sda2
   8        3   40960000 sda3
   8        4          1 sda4
   8        5   72079360 sda5
   8       32   52428800 sdc
   8       33   52428096 sdc1
   8       48   52428800 sdd
   8       49   52428096 sdd1
   8       64   52428800 sde
   8       65   52428096 sde1
   8       16   52428800 sdb
   8       17   52428096 sdb1
   8       80   52428800 sdf
   8       81   52428096 sdf1
   8      112  104857600 sdh
   8       96  209715200 sdg
   8       97  209712478 sdg1

[root@db1 ~]# fdisk /dev/sdh
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xbe78fa85.
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): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@db1 ~]# cat /proc/partitions
major minor  #blocks  name

   2        0          4 fd0
  11        0    1048575 sr0
   8        0  146800640 sda
   8        1     204800 sda1
   8        2   33554432 sda2
   8        3   40960000 sda3
   8        4          1 sda4
   8        5   72079360 sda5
   8       32   52428800 sdc
   8       33   52428096 sdc1
   8       48   52428800 sdd
   8       49   52428096 sdd1
   8       64   52428800 sde
   8       65   52428096 sde1
   8       16   52428800 sdb
   8       17   52428096 sdb1
   8       80   52428800 sdf
   8       81   52428096 sdf1
   8      112  104857600 sdh
   8      113  104856223 sdh1
   8       96  209715200 sdg
   8       97  209712478 sdg1
[root@db1 ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdb (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdc (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdd (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sde (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdf (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdg (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
[root@db1 ~]# /etc/init.d/oracleasm listdisks
ASM01
ASM02
ASM03
ASM04
ASM05
[root@db1 ~]# su - oracle
[oracle@db1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 10 12:04:36 2014

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

SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.
SQL> quit
Disconnected
[oracle@db1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-DEC-2014 12:05:09

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                09-DEC-2014 18:35:20
Uptime                    0 days 17 hr. 29 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/db1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=blogger.blogger.intranet)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@db1 ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-DEC-2014 12:05:17

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@db1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 10 12:05:26 2014

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

SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1.5667E+10 bytes
Fixed Size                  2268632 bytes
Variable Size            2113929768 bytes
Database Buffers         1.3522E+10 bytes
Redo Buffers               28127232 bytes
SQL> select name, path from v$asm_disk;

NAME                     PATH
---------------------    ------------------------------------
DSKDATA_0000   /dev/oracleasm/disks/ASM01

DSKDATA_0001   /dev/oracleasm/disks/ASM02

DSKDATA_0002    /dev/oracleasm/disks/ASM03

DSKDATA_0003   /dev/oracleasm/disks/ASM04

DSKDATA_0004   /dev/oracleasm/disks/ASM05


SQL> quit
Disconnected from Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
[oracle@db1 ~]$ su -
Password:
[root@db1 ~]# /etc/init.d/oracleasm createdisk AMS06 /dev/sdh1
Marking disk "AMS06" as an ASM disk:                       [  OK  ]
[root@db1 ~]# su - oracle
[oracle@db1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 10 12:10:44 2014

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

SQL> connect sys as sysdba
Enter password:
Connected.
SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/oracleasm/disks/AMS06
/dev/oracleasm/disks/ASM03
/dev/oracleasm/disks/ASM02
/dev/oracleasm/disks/ASM04
/dev/oracleasm/disks/ASM01
/dev/oracleasm/disks/ASM05

6 rows selected.

SQL> select name, total_mb, free_mb from v$asm_diskgroup;

NAME                             TOTAL_MB    FREE_MB
------------------------------ ----------            ----------
DSKDATA                       255995             57

SQL> quit
Disconnected from Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option
[oracle@db1 ~]$ cat /etc/oratab
#Backup file is  /opt/app/oracle/product/11.2.0/grid/srvm/admin/oratab.bak.db1 line added by Agent
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM:/opt/app/oracle/product/11.2.0/grid:N
TESTE:/opt/app/oracle/product/11.2.0/db_1:N             # line added by Agent
PRD:/opt/app/oracle/product/11.2.0/db_1:N          # line added by Agent
[oracle@db1 ~]$ export ORACLE_SID=+ASM
[oracle@db1 ~]$ export ORACLE_HOME=/opt/app/oracle/product/11.2.0/grid
[oracle@db1 ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@db1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 10 12:13:09 2014

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

SQL> connect sys as sysasm
Enter password:
Connected.
SQL> alter diskgroup DSKDATA add disk '/dev/oracleasm/disks/AMS06';

Diskgroup altered.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option
[oracle@db1 ~]$ export ORACLE_SID=PROD
[oracle@db1 ~]$ export ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1
[oracle@db1 ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@db1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 10 12:17:15 2014

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

SQL> connect sys as sysdba
Enter password:
Connected.
SQL> select name, total_mb, free_mb from v$asm_diskgroup;

NAME                             TOTAL_MB    FREE_MB
------------------------------ ----------            ----------
DSKDATA                       358393              102453

SQL>



 

Monday, December 8, 2014

ORACLE - ORA-00845: MEMORY_TARGET not supported on this system




-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 11:43:29 2014

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

SQL> connect sys as sysdba
Enter password: 
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL> exit
Disconnected

-bash-4.1$ cd $ORACLE_HOME
-bash-4.1$ cd dbs/
-bash-4.1$ ll
total 20
-rw-rw----. 1 oracle dba 1544 Dec  8 10:52 hc_XE.dat
-rwxr-xr-x. 1 oracle dba 2851 Aug 29  2011 init.ora
-rw-r-----. 1 oracle dba   24 Nov 11 11:42 lkXE
-rw-r-----  1 oracle dba 1536 Dec  8 10:50 orapwXE
-rw-r-----  1 oracle dba 2560 Dec  8 10:52 spfileXE.ora
-bash-4.1$ 
-bash-4.1$ cp spfileXE.ora spfileXE.ora.bkp
-bash-4.1$ ll
total 28
-rw-rw----. 1 oracle dba 1544 Dec  8 12:01 hc_XE.dat
-rwxr-xr-x  1 oracle dba 2851 Dec  8 11:54 init.ora
-rw-r-----. 1 oracle dba   24 Nov 11 11:42 lkXE
-rw-r-----  1 oracle dba 1536 Dec  8 10:50 orapwXE
-rw-r-----  1 oracle dba  881 Dec  8 11:57 spfileXE.ora
-rw-r-----  1 oracle dba 2560 Dec  8 11:56 spfileXE.ora.bkp


BEFORE EDIT
-bash-4.1$ cat spfileXE.ora.bkp 
C"???3CC2XE.__db_cache_size=197132288
XE.__java_pool_size=4194304
XE.__large_pool_size=4194304
XE.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
XE.__pga_aggregate_target=272629760
XE.__sga_target=515899392
XE.__shared_io_pool_size=0
XE.__shared_pool_size=301989888
XE.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/XE/adump'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/XE/control.dbf'
*.db_name='XE'
*.DB_RECOVERY_FILE_DEST='/u01/app/oraclCC"e/fast_recovery_area'
*.DB_RECOVERY_FILE_DEST_SIZE=10G
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=XEXDB)'
*.job_queue_processes=4
*.local_listener='(ADDRESS = (PROTOCOL=TCP) (HOST=cacti.siltechconsult.com.br) (PORT=1522))'
*.memory_target=786432000
*.open_cursors=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=20
*.shared_servers=4
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
CC"GeCC"FeC-bash-4.1$ 

-bash-4.1$ vim spfileXE.ora

LATER EDIT 
-bash-4.1$ cat spfileXE.ora
*.audit_file_dest='/u01/app/oracle/admin/XE/adump'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/XE/control.dbf'
*.db_name='XE'
*.DB_RECOVERY_FILE_DEST='/u01/app/oracle/fast_recovery_area'
*.DB_RECOVERY_FILE_DEST_SIZE=10G
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=XEXDB)'
*.job_queue_processes=4
*.local_listener='(ADDRESS = (PROTOCOL=TCP) (HOST=cacti.siltechconsult.com.br) (PORT=1522))'
*.memory_target=500M
*.open_cursors=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=20
*.shared_servers=4
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
-bash-4.1$ 
-bash-4.1$ pwd
/u01/app/oracle/product/11.2.0/xe/dbs
-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 12:03:40 2014

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

SQL> connect sys as sysdba
Enter password: 
Connected to an idle instance.
SQL> startup pfile='/u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora';
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size     2228080 bytes
Variable Size   314572944 bytes
Database Buffers   201326592 bytes
Redo Buffers     3809280 bytes
Database mounted.
Database opened.
SQL> 


ORACLE - ORA-01031: insufficient privileges


[root@cacti ~]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:04:53 2014

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

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01031: insufficient privileges


SQL> connect siltech/siltech
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0



SQL> exit
[root@cacti ~]# less .bash_profile 
[root@cacti ~]# su - oracle
-bash-4.1$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
-bash-4.1$ export ORACLE_SID=xe
-bash-4.1$ export PATH=$PATH:$ORACLE_HOME/bin
-bash-4.1$ export ORACLE_BASE=/u01/app/oracle; 
-bash-4.1$ export ORACLE_TER=Mxterm; 
-bash-4.1$ export PATH=/usr/sbin:$PATH; 
-bash-4.1$ export PATH=$ORACLE_HOME/bin:$PATH; 
-bash-4.1$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; 
-bash-4.1$ export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; 
-bash-4.1$ 
-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:07:37 2014

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

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01031: insufficient privileges


SQL> exit
-bash-4.1$
-bash-4.1$ pwd
/u01/app/oracle
-bash-4.1$ ll
total 24
drwxr-x---. 4 oracle dba  4096 Nov 11 11:42 admin
-rw-r--r--  1 oracle dba     0 Dec  8 10:05 connect
drwxrwxr-x. 4 oracle dba  4096 Nov 26 08:06 diag
-rw-r--r--  1 oracle dba     0 Dec  8 10:06 exit
drwxr-x---. 3 oracle dba  4096 Nov 11 11:42 fast_recovery_area
drwxr-x---. 3 oracle dba  4096 Nov 11 11:42 oradata
drwxr-xr-x. 3 oracle dba  4096 Nov 11 11:42 oradiag_oracle
drwxr-xr-x. 3 root   root 4096 Nov 11 11:40 product
-bash-4.1$ 
[root@cacti /]# chown oracle:dba -R /u01/
[root@cacti oracle]# ll
total 24
drwxr-x---. 4 oracle dba 4096 Nov 11 11:42 admin
-rw-r--r--  1 oracle dba    0 Dez  8 10:05 connect
drwxrwxr-x. 4 oracle dba 4096 Nov 26 08:06 diag
-rw-r--r--  1 oracle dba    0 Dez  8 10:06 exit
drwxr-x---. 3 oracle dba 4096 Nov 11 11:42 fast_recovery_area
drwxr-x---. 3 oracle dba 4096 Nov 11 11:42 oradata
drwxr-xr-x. 3 oracle dba 4096 Nov 11 11:42 oradiag_oracle
drwxr-xr-x. 3 oracle dba 4096 Nov 11 11:40 product

[root@cacti ~]# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:13:13 2014

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

SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-12547: TNS:lost contact


SQL>exit
[root@cacti bin]# su - oracle
-bash-4.1$ cd /u01/app/oracle/product/11.2.0/xe/bin/
-bash-4.1$ ./sqlplus 
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
-bash-4.1$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe/
-bash-4.1$ ./sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:24:13 2014

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

Enter user-name: system
Enter password: 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
-bash-4.1$ export ORACLE_SID=XE
-bash-4.1$ ./sqlplus 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
SQL> connect sys as sysdba
Enter password: 
ERROR:
ORA-01017: invalid username/password; logon denied

-bash-4.1$ ll
total 20
-rw-rw----. 1 oracle dba 1544 Nov 11 11:43 hc_XE.dat
-rwxr-xr-x. 1 oracle dba 2851 Aug 29  2011 init.ora
-rw-r-----. 1 oracle dba   24 Nov 11 11:42 lkXE
-rw-r-----. 1 oracle dba 1536 Nov 11 11:43 orapwXE
-rw-r-----  1 oracle dba 2560 Dec  4 10:48 spfileXE.ora
-bash-4.1$ pwd
/u01/app/oracle/product/11.2.0/xe/dbs
-bash-4.1$ orapwd 
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

  where
    file - name of password file (required),
    password - password for SYS will be prompted if not specified at command line,
    entries - maximum number of distinct DBA (optional),
    force - whether to overwrite existing file (optional),
    ignorecase - passwords are case-insensitive (optional),
    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
    
  There must be no spaces around the equal-to (=) character.
-bash-4.1$ orapwd file=orapwXE password=123456

OPW-00005: File with same name exists - please delete or rename
-bash-4.1$ rm -rf orapwXE 
-bash-4.1$ orapwd file=orapwXE password=123456
-bash-4.1$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Mon Dec 8 10:50:50 2014

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


SQL> connect sys as sysdba
Enter password: 
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  784998400 bytes
Fixed Size     2230608 bytes
Variable Size   583009968 bytes
Database Buffers   197132288 bytes
Redo Buffers     2625536 bytes
Database mounted.
Database opened.
SQL> 










Friday, November 29, 2013

Oracle - Automating Database Startup / Linux



# vi /etc/oratab


SINTEXA:
[NOME_DA_INSTÂNCIA]:[ORACLE_HOME]:[Y/N]

[NOME_DA_INSTÂNCIA] : USER/ORACLE $echo $ORACLE_SID;
[ORACLE_HOME] : USER/ORACLE  $echo $ORACLE_HOME.
[Y/N] : Y= Automating Startup /  N= No Automating Startup  .

Example

root@aix(/)# su - oracle
[YOU HAVE NEW MAIL]
$ . ./profileoracle
$ echo $ORACLE_HOME
/opt/app/oracle/product/11.2.0/db_1
$ echo $ORACLE_SID
orcl
$ cat /etc/oratab
orcl:/opt/app/oracle/product/11.2.0/db_1:Y              # line added by Agent
#orcl:/opt/app/oracle/product/11.2.0/db_1:N             # line added by Agent

Thursday, November 28, 2013

Lunix - SSH Authorized



Machine Authorized

[root@srv-gama .ssh]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
[root@srv-gama .ssh]#
[root@srv-gama .ssh]#
[root@srv-gama .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
5c:26:56:84:00:63:a8:5e:12:6a:40:e2:0d:c1:78:45 root@srv-gama
[root@srv-gama .ssh]# ls -lat
total 24
drwx------  2 root root 4096 Jun 20 08:36 .
-rw-------  1 root root 1675 Jun 20 08:36 id_rsa
-rw-r--r--  1 root root  395 Jun 20 08:36 id_rsa.pub
drwxr-x--- 25 root root 4096 Jun 20 08:29 ..
-rw-r--r--  1 root root 1183 Jul 10  2009 known_hosts
[root@srv-gama .ssh]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
79:ad:fc:b1:a9:19:6d:6d:5d:f4:ec:08:c8:6e:ef:76 root@srv-gama
[root@srv-gama .ssh]# ls -lat
total 32
drwx------  2 root root 4096 Jun 20 08:36 .
-rw-------  1 root root  672 Jun 20 08:36 id_dsa
-rw-r--r--  1 root root  603 Jun 20 08:36 id_dsa.pub
-rw-------  1 root root 1675 Jun 20 08:36 id_rsa
-rw-r--r--  1 root root  395 Jun 20 08:36 id_rsa.pub
drwxr-x--- 25 root root 4096 Jun 20 08:29 ..
-rw-r--r--  1 root root 1183 Jul 10  2009 known_hosts
[root@srv-gama .ssh]# more id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvyxuEL8ruqzgQQd3yT9kpjQDCoOw1lyxNo9/OVtXkrgOQjS5uc4gpPgZULmHsafsFAP4Rv6JVevD3zyQP30tF/Yr04Hqe8vVVlyj962SWGvd2/T8Nk7jAFvdDVlrnkzUya++QmrUxJZlADF
PfPxquBJbHOuguhZcJmQN5nzPlvEMyiI1JpcT8kIReE8iNMfQ9Bwr2J4wPZRhc5AfLjjXgxP7356Zzss3YcRGbO4NAx+h0SN5ULingkrdjqrj9TLfem+uLj5KFt2dgHdoPvW+FdEHEEgrjngzzaGpRXn7zle5wg7cWoJCmWhM2C9AACPlbk
ev5hmWwid+r68FxX/jXw== root@srv-gama
[root@srv-gama .ssh]# more id_dsa.pub 
ssh-dss AAAAB3NzaC1kc3MAAACBANrW/auJEH+kvPFZ5WDaBULUv/sUVEOWkhpvSmEFg9WWoceMsBG9wvZWON3VzrLjwbvJRckxzUIzHUx3oQhNo2GYT++SNI4oMPv9M7/a1tdVcIwtpvhwQ/DolzQjmUvuPs8ErcvW9oxgbglLI/UjESa
t6f1HEAyMJHAsVT76K753AAAAFQDX306rlTgEZ2nNnO3ROQ8W4UE8cQAAAIEA0FfFW+i+xm/sL0HVJRx6ax83ul1QClOwi3tSugNCFyTIWhrNMv8UfA+Dx4x1r2vx/l9+1S8NLTnob9nQVmCv4Qrtv5VRQwriGA2wagnfXGcSjbVE6Dq3PE
DQB8oxFNHy3N4JXF0wCJZGpRvMNl77mcXE7Jz46Dhxi7NSaMpXvdsAAACBANFma3xWHXqP/d6bbVpzMlmgzMHZR8rjAh7AlyKj2FNiqgXBxuoJTls9mEJf/2sJksrAi1bqzLGH8jw/6qENPYnwHJeFQigogr7/KdZOtf5hWV96sYfxTwUG0
0nKRR8jyBr9v3JJVggoRsIB2/B6iVRC5BFoYXG0VSHNFUeJaLRV root@srv-gama



Machine destination

[root@srv-alpha .ssh]# ls -lat
total 16
drwxr-x--- 22 root root 4096 Jun 20 10:01 ..
drwx------  2 root root 4096 Jul 15  2010 .
-rw-r--r--  1 root root  395 Jul 15  2010 known_hosts
[root@srv-alpha .ssh]# vi authorized_keys

COPY TEXT "ssh-dss  + ssh-rsa"  >>  authorized_keys