Wednesday, December 30, 2015

awk print quote

Print single quote:
awk '{print "'"'"'" $1 "'"'"',"}' a.txt >configureBody.sql

Print double quotes:
awk -F: '{gsub(/ /,""); print "\"secrets.passwords."$1"\"=\""$2"\""}' s.txt

Wednesday, November 25, 2015

Oracle Listener Block IPs

Reference: http://www.dba-oracle.com/t_blocking_listener_ip_addresses.htm

$ cat /usr2/app/oracle/product/11.2.0.3/network/admin/sqlnet.ora

#
NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES, ONAMES, HOSTNAME)

tcp.validnode_checking = yes
tcp.invited_nodes = (localhost,streaming)

Monday, November 16, 2015

Recover Oracle Database from Cold backup and new archivelogs

Recover Oracle Database from Cold backup and new archivelogs

Condition: all the new archivelog since last cold backup must be in place, otherwise, it will fail.

Copy cold Backup and layout them as product environment
Replace controlfiles with new ones
if archive logs are in new place, you can catalog them like below:
CATALOG START WITH '/path/to/archivelogs';

SQL> startup mount
ORACLE instance started.

Total System Global Area 4009738240 bytes
Fixed Size                  2165512 bytes
Variable Size            1476400376 bytes
Database Buffers         2483027968 bytes
Redo Buffers               48144384 bytes
Database mounted.

RMAN> run {
  set until time "to_date('2015-11-08:00:00:00', 'yyyy-mm-dd:hh24:mi:ss')";
  recover database;
  }

if it RMAN backup, you restore database first, then recover database like below:

RMAN> run {
  set until time "to_date('2015-11-08:00:00:00', 'yyyy-mm-dd:hh24:mi:ss')";
  restore database;
  recover database;
  }

Tuesday, November 10, 2015

Thursday, November 5, 2015

How to mount Windows Drive on Linux

Reference: https://access.redhat.com/solutions/448263
mount -t cifs -o username=administrator,password=<password> //servername/<your windows share> /mnt

mount -t cifs -o username=administrator,password=<password> //servername/c$ /mnt

Friday, October 16, 2015

Grep to find the lines

Ref: http://unix.stackexchange.com/questions/28158/is-there-a-tool-to-get-the-lines-in-one-file-that-are-not-in-another


The standard grep tool for searching files for text strings can be used to subtract all the lines in one file from another.
grep -F -x -v -f fileB fileA
This works by using each line in fileB as a pattern (-f fileB) and treating it as a plain string to match (not a regular regex) (-F). You force the match to happen on the whole line (-x) and print out only the lines that don't match (-v). Therefore you are printing out the lines in fileA that don't contain the same data as any line in fileB.

Thursday, August 27, 2015

How to expand LUN on Solaris

1 Expand LUN on SAN side

2. Add it to current SMI Label
# format                                   
Searching for disks...done                             


AVAILABLE DISK SELECTIONS:
       0. c0t5000CCA0562C310Cd0 <HITACHI-H109060SESUN600G-A690-558.91GB>
          /scsi_vhci/disk@g5000cca0562c310c                            
          /dev/chassis/SYS/SASBP/HDD0/disk                             
       1. c0t5000CCA0562C3070d0 <HITACHI-H109060SESUN600G-A690 cyl 64986 alt 2 hd 27 sec 668>  solaris
          /scsi_vhci/disk@g5000cca0562c3070                                                          
          /dev/chassis/SYS/SASBP/HDD1/disk                                                           
       2. c0t60080E500036B7F800000C0C55B86E3Ad0 <SUN-LCSM100_F-0784 cyl 15358 alt 2 hd 64 sec 64>    
          /scsi_vhci/ssd@g60080e500036b7f800000c0c55b86e3a                                           
       3. c0t60080E500036B7F800000C0E55B86ED1d0 <SUN-LCSM100_F-0784 cyl 30718 alt 2 hd 64 sec 64>    
          /scsi_vhci/ssd@g60080e500036b7f800000c0e55b86ed1                                           
       4. c0t60080E500036B7F800000C0955B86D60d0 <SUN-LCSM100_F-0784 cyl 38398 alt 2 hd 128 sec 64>   
          /scsi_vhci/ssd@g60080e500036b7f800000c0955b86d60                                           
       5. c7t5d31 <SUN-Universal Xport-0784 cyl 8 alt 2 hd 64 sec 64>                                
          /pci@400/pci@2/pci@0/pci@8/SUNW,qlc@0/fp@0,0/ssd@w20660080e53683c6,1f                      
       6. c8t10d31 <SUN-Universal Xport-0784 cyl 8 alt 2 hd 64 sec 64>                               
          /pci@400/pci@2/pci@0/pci@8/SUNW,qlc@0,1/fp@0,0/ssd@w20570080e53683c6,1f                    
Specify disk (enter its number): 4                                                                   
selecting c0t60080E500036B7F800000C0955B86D60d0                                                      
[disk formatted]                                                                                     
Note: detected additional allowable expansion storage space that can be                              
added to current SMI label's computed capacity.                                                      
Select <partition> <expand> to adjust the label capacity.                                            


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk       
        format     - format and analyze the disk     
        repair     - repair a defective sector       
        label      - write label to the disk         
        analyze    - surface analysis                
        defect     - defect list management          
        backup     - search for backup labels        
        verify     - read and display labels         
        save       - save new disk/partition definitions
        inquiry    - show disk ID                      
        volname    - set 8-character volume name       
        !<cmd>     - execute <cmd>, then return        
        quit                                           
format> type                                           


AVAILABLE DRIVE TYPES:
        0. Auto configure
        1. Quantum ProDrive 80S
        2. Quantum ProDrive 105S
        3. CDC Wren IV 94171-344
        4. SUN0104             
        5. SUN0207             
        6. SUN0327             
        7. SUN0340             
        8. SUN0424             
        9. SUN0535             
        10. SUN0669            
        11. SUN1.0G            
        12. SUN1.05            
        13. SUN1.3G            
        14. SUN2.1G            
        15. SUN2.9G
        16. Zip 100
        17. Zip 250
        18. Peerless 10GB
        19. HITACHI-H109060SESUN600G-A690
        20. SUN-LCSM100_F-0784
        21. SUN-LCSM100_F-0784
        22. SUN-LCSM100_F-0784
        23. SUN-Universal Xport-0784
        24. other
Specify disk type (enter its number)[20]: 0
c0t60080E500036B7F800000C0955B86D60d0: configured with capacity of 159.99GB
<SUN-LCSM100_F-0784 cyl 40958 alt 2 hd 128 sec 64>
selecting c0t60080E500036B7F800000C0955B86D60d0
[disk formatted]
format> p


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (default):
Total disk cylinders available: 40958 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    31      128.00MB    (32/0/0)       262144
  1       swap    wu      32 -    63      128.00MB    (32/0/0)       262144
  2     backup    wu       0 - 40957      159.99GB    (40958/0/0) 335527936
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm      64 - 40957      159.74GB    (40894/0/0) 335003648
  7 unassigned    wm       0                0         (0/0/0)             0

partition> q
format> label
Ready to label disk, continue? yes
Login as Grid user

 $ sqlplus / as sysasm
 SQL> alter diskgroup DATA resize all;

Diskgroup altered.

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

NAME                             TOTAL_MB USABLE_FILE_MB
------------------------------ ---------- --------------
ARC                                 61180          61044
DATA                               163576          46175
FRA                                 30460          30365

Friday, July 24, 2015

Setup and Refresh Local Solaris IPS


Download Latest SRU (Both Repository and Installation Guide) from
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=528645295474932&id=1672221.1&displayIndex=8&_afrWindowMode=0&_adf.ctrl-state=15fchlf0j1_53


The IPS binaries are same for Sparc and X86-64

Assume the files are downloaded in /solarisIPS/download

Unzip the installation guide only, and  install-repo.ksh can be found
Use 11.2.12.6 as sample here.

# mkdir -p /solarisIPS/11.2.12.6/

# ./install-repo.ksh -d /solarisIPS/11.2.12.6/ -c -v

root@goweek01:/solarisIPS# pkg info entire
          Name: entire
       Summary: Incorporation to lock all system packages to the same build
   Description: This package constrains system package versions to the same
                build.  WARNING: Proper system update and correct package
                selection depend on the presence of this incorporation.
                Removing this package will result in an unsupported system.
      Category: Meta Packages/Incorporations
         State: Installed
     Publisher: solaris
       Version: 0.5.11
 Build Release: 5.11
        Branch: 0.175.2.1.0.2.1
Packaging Date: September 23, 2014 10:49:40 PM
          Size: 5.46 kB
          FMRI: pkg://solaris/entire@0.5.11,5.11-0.175.2.1.0.2.1:20140923T224940Z

root@goweek01:/solarisIPS/downloads# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://pkg.oracle.com/solaris/release/

# pkg set-publisher -G '*' -M '*' -g file:///solarisIPS/11.2.12.6 solaris

root@goweek01:/solarisIPS/11.2.12.6# pkg set-publisher -G '*' -M '*' -g file:///solarisIPS/11.2.12.6 solaris
root@goweek01:/solarisIPS/11.2.12.6# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F file:///solarisIPS/11.2.12.6/

# pkg set-publisher -G '*' -M '*' -g http://pkg.oracle.com/solaris/release/ solaris

# pkgrecv -s http://pkg.oracle.com/solaris/release/ -d /solarisIPS/11.2.12.6 solaris '*'

# pkg update

            Packages to remove:   4                                                                                                                                 
           Packages to install:  36                                                                                                                                 
            Packages to update: 284                                                                                                                                 
            Packages to change:   1                                                                                                                                 
           Mediators to change:   1                                                                                                                                 
       Create boot environment: Yes                                                                                                                                 
Create backup boot environment:  No                                                                                                                                 
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED                                                                                     
Completed                            325/325   17884/17884  481.0/481.0    0B/s                                                                                     

PHASE                                          ITEMS
Removing old actions                       3692/3692
Installing new actions                   11695/11695
Updating modified actions                15099/15099
Updating package state database                 Done
Updating package cache                       288/288
Updating image state                            Done
Creating fast lookup database                   Done
Updating package cache                           1/1

A clone of solaris exists and has been updated and activated.
On the next boot the Boot Environment solaris-1 will be     
mounted on '/'.  Reboot when ready to switch to this updated BE.

Updating package cache                           1/1

---------------------------------------------------------------------------
NOTE: Please review release notes posted at:                              

http://www.oracle.com/pls/topic/lookup?ctx=solaris11&id=SERNS
---------------------------------------------------------------------------

root@goweek01:~# pkg info entire
          Name: entire
       Summary: entire incorporation including Support Repository Update (Oracle Solaris 11.2.12.6.0).
   Description: This package constrains system package versions to the same
                build.  WARNING: Proper system update and correct package
                selection depend on the presence of this incorporation.
                Removing this package will result in an unsupported system.  For
                more information see:
                https://support.oracle.com/rs?type=doc&id=1672221.1
      Category: Meta Packages/Incorporations
         State: Installed
     Publisher: solaris
       Version: 0.5.11 (Oracle Solaris 11.2.12.6.0)
 Build Release: 5.11
        Branch: 0.175.2.12.0.6.0
Packaging Date: July 15, 2015 02:05:32 PM
          Size: 5.46 kB
          FMRI: pkg://solaris/entire@0.5.11,5.11-0.175.2.12.0.6.0:20150715T140532Z
root@goweek01:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F file:///solarisIPS/11.2.12.6/
root@goweek01:~# pkg list -af entire
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.2.12.0.6.0    i--
entire                                            0.5.11-0.175.2.1.0.2.1     ---
entire                                            0.5.11-0.175.2.1.0.2.0     ---
entire                                            0.5.11-0.175.2.0.0.42.0    ---
entire                                            0.5.11-0.175.1.0.0.24.2    ---
entire                                            0.5.11-0.175.0.10.1.0.0    ---
entire                                            0.5.11-0.175.0.0.0.2.0     ---
entire                                            0.5.11-0.151.0.1           ---

Tuesday, July 21, 2015

Oracle: Check User Locks

sqlplus system/******** <<ENDSQL> /dev/null
clear buffer
set feedback off
set pause off
column USERID FORMAT A9;
column SID FORMAT 6;
column USER_B FORMAT A9;
column SID_B FORMAT 6;
spool $HOME/userlocks
SELECT rtrim(DECODE(request,0,'Holder: ','Waiter: ')|| v1.sid ||' - ' ||V2.USERNAME) "Session",
       lmode,
       v1.request,
       v2.STATUS,
       v2.COMMAND,
       v2.PROCESS "OS PROCESS",
       v1.type
  FROM V\$LOCK V1,
       V\$SESSION V2
 WHERE (V1.id1, V1.id2, V1.type) IN (SELECT id1, id2, type
                                       FROM V\$LOCK
                                      WHERE request>0)
   AND V1.SID = V2.SID
 ORDER BY v1.id1, v1.request;
/

spool off
ENDSQL

Friday, July 17, 2015

ORA-01858: a non-numeric character was found where a numeric was expected

OS: Solaris 10
JVM Container: WAS 8.0

Problem:

[16/07/15 8:59:58:235 EDT] 00000016 BusinessExcep E   CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "init" on bean "BeanId". Exception data: <openjpa-2.1.2-SNAPSHOT-r422266:1333100 fatal general error> org.apache.openjpa.persistence.PersistenceException: ORA-01858: a non-numeric character was found where a numeric was expected

Solution:


Set Environment Variable LC_ALL to en_US.UTF-8
echo "Set Locale to use en_US.UTF-8"

LC_ALL=en_US.UTF-8; export LC_ALL

locale

Thursday, July 16, 2015

WebSphere: French Character Problem in created file


# cat start_was.sh
#!/bin/sh

echo "Set Locale to use en_US.UTF-8"

LC_ALL=en_US.UTF-8; export LC_ALL

locale

cd /opt/IBM/WebSphere/AppServer/bin
echo "Starting IBM Deployment Manager"
./startManager.sh -profileName $1

echo "Starting NodeAgent"
./startNode.sh -profileName $2

echo "Starting WAS"
./startServer.sh -profileName $2 server1

locale

Tuesday, June 16, 2015

RAC One Failed because archivelog is full


$ srvctl start database -d RACTST
PRCR-1079 : Failed to start resource ora.ractst.db
CRS-5017: The resource action "ora.ractst.db start" encountered the following error:
ORA-03113: end-of-file on communication channel
Process ID: 3208
Session ID: 577 Serial number: 1
. For details refer to "(:CLSN00107:)" in "/u01/11.2.0/grid/log/gw6/agent/crsd/oraagent_oracle/oraagent_oracle.log".

CRS-2674: Start of 'ora.ractst.db' on 'gw6' failed
CRS-5017: The resource action "ora.ractst.db start" encountered the following error:
ORA-03113: end-of-file on communication channel
Process ID: 3200
Session ID: 253 Serial number: 1
. For details refer to "(:CLSN00107:)" in "/u01/11.2.0/grid/log/gw8/agent/crsd/oraagent_oracle/oraagent_oracle.log".

CRS-2674: Start of 'ora.ractst.db' on 'sun08' failed
CRS-2632: There are no more servers to try to place resource 'ora.ractst.db' on that would satisfy its placement policy


Trouble Shooting
$ srvctl start database -d RACTST -o mount

$ rman target sys/********@scan-name:1521/RACTST
RMAN> list archivelog all;
RMAN> delete archivelog all;

$ srvctl stop database -d RACTST
$ srvctl start database -d RACTST

Thursday, June 11, 2015

Oracle Grant Privileges to ETL Account

Create Read Only Role

Login as Objects Owner
CREATE ROLE OWNER_READONLY;
GRANT SELECT ANY TABLE TO OWNER_READONLY;
GRANT SELECT ANY TRANSACTION TO OWNER_READONLY;

Grant Role to user

Login as sys
GRANT OWNER_READONLY TO DW_ETL;

Wednesday, June 10, 2015

NFS Version 4 Connection

# mount -t nfs4 vsun01:/ishare /mnt
on Solaris, nfsstat will show the connection statistics


# nfsstat                   

Server rpc:
Connection oriented:
calls      badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs   
74683      0          0          0          0          2308       0         
Connectionless:                                                             
calls      badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs   
9          0          0          0          0          0          0         

Server NFSv2:
calls      badcalls   referrals  referlinks
3          0          0          0         

Server NFSv3:
calls      badcalls   referrals  referlinks
7230       0          0          0         

Server NFSv4:
calls      badcalls   referrals  referlinks
54         0          0          0         
Version 2: (3 calls)                       
null     getattr  setattr  root     lookup   readlink read     wrcache 
3 100%   0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%    
write    create   remove   rename   link     symlink  mkdir    rmdir   
0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%    
readdir  statfs                                                        
0 0%     0 0%                                                          
Version 3: (7132 calls)                                                
null        getattr     setattr     lookup      access      readlink   
6 0%        1220 17%    0 0%        280 3%      530 7%      0 0%       
read        write       create      mkdir       symlink     mknod      
1758 24%    2166 30%    66 0%       0 0%        0 0%        0 0%       
remove      rmdir       rename      link        readdir     readdirplus
66 0%       0 0%        0 0%        0 0%        0 0%        10 0%      
fsstat      fsinfo      pathconf    commit                             
960 13%     2 0%        1 0%        67 0%                              
Version 4: (54 calls)                                                  
null                compound                                           
2 3%                52 96%                                             
Version 4: (115 operations)                                            
reserved            access              close               commit             
0 0%                4 3%                1 0%                0 0%               
create              delegpurge          delegreturn         getattr            
0 0%                0 0%                0 0%                41 35%             
getfh               link                lock                lockt              
7 6%                0 0%                0 0%                0 0%               
locku               lookup              lookupp             nverify            
0 0%                4 3%                0 0%                0 0%               
open                openattr            open_confirm        open_downgrade     
1 0%                0 0%                1 0%                0 0%               
putfh               putpubfh            putrootfh           read               
43 37%              0 0%                2 1%                0 0%               
readdir             readlink            remove              rename             
2 1%                0 0%                1 0%                0 0%               
renew               restorefh           savefh              secinfo            
1 0%                0 0%                0 0%                0 0%               
setattr             setclientid         setclientid_confirm verify             
1 0%                3 2%                3 2%                0 0%               
write               release_lockowner   illegal                                
0 0%                0 0%                0 0%                                   

Server nfs_acl:
Version 2: (0 calls)
null        getacl      setacl      getattr     access      getxattrdir
0 0%        0 0%        0 0%        0 0%        0 0%        0 0%       
Version 3: (0 calls)                                                   
null        getacl      setacl      getxattrdir                        
0 0%        0 0%        0 0%        0 0%                               

Client rpc:
Connection oriented:
calls      badcalls   badxids    timeouts   newcreds   badverfs   timers    
688837     0          0          0          0          0          0         
cantconn   nomem      interrupts                                            
0          0          0                                                     
Connectionless:                                                             
calls      badcalls   retrans    badxids    timeouts   newcreds   badverfs  
0          0          0          0          0          0          0         
timers     nomem      cantsend                                              
0          0          0                                                     

Client nfs:
calls      badcalls   clgets     cltoomany 
688819     0          0          0         
Version 2: (0 calls)
null     getattr  setattr  root     lookup   readlink read     wrcache
0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%
write    create   remove   rename   link     symlink  mkdir    rmdir
0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%     0 0%
readdir  statfs
0 0%     0 0%
Version 3: (0 calls)
null        getattr     setattr     lookup      access      readlink
0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
read        write       create      mkdir       symlink     mknod
0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
remove      rmdir       rename      link        readdir     readdirplus
0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
fsstat      fsinfo      pathconf    commit
0 0%        0 0%        0 0%        0 0%
Version 4: (688815 calls)
null                compound
0 0%                688815 100%
Version 4: (1785319 operations)
reserved            access              close               commit
0 0%                71039 3%            67444 3%            71049 3%
create              delegpurge          delegreturn         getattr
0 0%                0 0%                67420 3%            367238 20%
getfh               link                lock                lockt
74340 4%            0 0%                0 0%                0 0%
locku               lookup              lookupp             nverify
0 0%                7729 0%             7 0%                8742 0%
open                openattr            open_confirm        open_downgrade
67455 3%            9 0%                20 0%               0 0%
putfh               putpubfh            putrootfh           read
651851 36%          0 0%                21 0%               121 0%
readdir             readlink            remove              rename
30 0%               0 0%                28 0%               588 0%
renew               restorefh           savefh              secinfo
37539 2%            6871 0%             8310 0%             9 0%
setattr             setclientid         setclientid_confirm verify
70887 3%            3 0%                3 0%                19 0%
write
206547 11%

Client nfs_acl:
Version 2: (0 calls)
null        getacl      setacl      getattr     access      getxattrdir
0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
Version 3: (0 calls)
null        getacl      setacl      getxattrdir
0 0%        0 0%        0 0%        0 0%

Tuesday, June 9, 2015

Open LDAP troubleshooting


# certutil -d /etc/openldap/cacerts.pem -L

# ldapsearch -H ldaps://ldap.goweekend.ca -d 255 -x uid=aniu

Wednesday, April 22, 2015

Oracle Database Performance Troubleshooting Diary

Find block sessions


SELECT s1.username || '@' || s1.machine
    || ' ( SID=' || s1.sid || ' )  is blocking '
    || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
    FROM v$lock l1, v$session s1, v$lock l2, v$session s2
    WHERE s1.sid=l1.sid AND s2.sid=l2.sid
    AND l1.BLOCK=1 AND l2.request > 0
    AND l1.id1 = l2.id1
    AND l1.id2 = l2.id2;

Find User, Hostname and Program Information


select
   substr(a.spid,1,9) pid,
   substr(b.sid,1,5) sid,
   substr(b.serial#,1,5) ser#,
   substr(b.machine,1,6) box,
   substr(b.username,1,10) username,
   -- b.server,
   substr(b.osuser,1,8) os_user,
   substr(b.program,1,30) program
from
   v$session b,
   v$process a
where
b.paddr = a.addr
and type='USER' and b.username = 'xxxxxx'
order by spid;

select * from user_source where name like 'RESE%';

alter user itservice identified by s2Atrupr2hE;
Select * from v$session;

select
   'ALTER SYSTEM KILL SESSION ''' || sid || ',' || b.serial# || ''';'
from
   v$session b,
   v$process a
where
b.paddr = a.addr
and type='USER' and b.username like 'USERNAME%'
order by spid;

Find Job information


SELECT o.name object_name, u.name object_owner, o.obj# job_id FROM
obj$ o, user$ u WHERE
o.owner# = u.user# and o.obj# = 42;

Get SQl ID

select * from v$session where sid = 42; 

Get SQL Text


set heading off;
select * from v$sqltext where sql_id = 'd4k1q04fmwrjq' order by piece;

Wednesday, April 8, 2015

Kill Oracle Session

Below scripts is quoted from http://www.dba-oracle.com/tips_killing_oracle_sessions.htm

rem session.sql - displays all connected sessions

set echo off;
set termout on;
set linesize 80;
set pagesize 60;
set newpage 0;

select
rpad(c.name||':',11)||rpad(' current logons='||
(to_number(b.sessions_current)),20)||'cumulative logons='||
rpad(substr(a.value,1,10),10)||'highwater mark='||
b.sessions_highwater Information
from
   v$sysstat a,
   v$license b,
   v$database c
where
a.name = 'logons cumulative'
;

ttitle "dbname Database|UNIX/Oracle Sessions";

set heading off;
select 'Sessions on database '||substr(name,1,8) from v$database;
set heading on;

select
   substr(a.spid,1,9) pid,
   substr(b.sid,1,5) sid,
   substr(b.serial#,1,5) ser#,
   substr(b.machine,1,6) box,
   substr(b.username,1,10) username,
   -- b.server,
   substr(b.osuser,1,8) os_user,
   substr(b.program,1,30) program
from
   v$session b,
   v$process a
where
b.paddr = a.addr
and type='USER'
order by spid;
ttitle off;
set heading off;
select 'To kill, enter SQLPLUS> ALTER SYSTEM KILL SESSION',
''''||'SID, SER#'||''''||';' from dual;
spool off;

Wednesday, April 1, 2015

SPARC: Initiate ILOM


set /SP/network pendingipdiscovery=static pendingipaddress=17.15.21.77 pendingipgateway=17.15.21.1 pendingipnetmask=255.255.255.0 commitpending=true

set /SP hostname=gweek-rsc system_identifier=GOWEEKENDIT

Monday, February 23, 2015

Reset Windows Terminal Server License

Terminal Server License Reset
  1. Log-in to the Windows Server that has the expiration notice.
  2. Stop the Terminal Licensing Service
  3. Go to C:\WINDOWS\system32\LServer
  4. Remove all the content of this folder
  5. Restart the Terminal Licensing Service

Wednesday, February 4, 2015

Logs and Directories

Oracle VM Server Directories

 https://docs.oracle.com/cd/E26996_01/E18549/html/VMUSG747.html

 

 

Friday, January 9, 2015

Thursday, January 8, 2015

Startup NFS Client on Solaris 11

svcadm enable svc:/network/nfs/rquota:default
svcadm enable svc:/network/nfs/mapid:default
svcadm enable svc:/network/nfs/status:default
svcadm enable svc:/network/nfs/nlockmgr:default
svcadm enable svc:/network/nfs/server:default
svcadm enable svc:/network/nfs/cbd:default

Install xterm on Solaris 11


Download Oracle Key and Certificate

  1. # pkg unset-publisher solaris
  2. # pkg set-publisher -k /security/solaris11/publisher/pkg.oracle.com.key.pem -c /security/solaris11/publisher/pkg.oracle.com.certificate.pem -G "*" -g https://pkg.oracle.com/solaris/support/ --proxy http://proxy.ibm.ca:8000 solaris
  3. xauth - required to allow ssh to set up X11 forwarding with authentication
    # pkg install xauth
  4. x11/diagnostic/x11-info-clients - required for software that executes xdpyinfo
    # pkg install x11/diagnostic/x11-info-clients
  5. library/motif - required for software that has a Motif GUI
    # pkg install library/motif
  6. terminal/xterm
    # pkg install xterm
or

# pkg install xauth  x11/diagnostic/x11-info-clients library/motif xterm

Change no_files in Solaris

Referen: http://serverfault.com/questions/21417/how-to-set-ulimits-in-solaris-10


To make it a system-wide change, edit /etc/system with following entries
# Hard limit on file descriptors for single process
set rlim_fd_max = 4096

# Soft limit on the file descriptors for a single process
set rlim_fd_cur = 1024

NOTE: without setting rlim_fd_max as shown above, the default value for file descriptors or nofiles is half of the rlim_fd_cur value. So, it's best to set them both.
If you are using a Solaris project for an application space like Oracle Database, you can set the max file descriptors in the project by:

projmod -s -K "process.max-file-descriptor=(privileged,1024,deny)" user.root


Tuesday, January 6, 2015