Thursday, August 29, 2013

Wednesday, August 28, 2013

SAS Folders and Logs



C:\SAS\StrategyManagementConfig\Lev1\Documents\Instructions.html


Monday, August 26, 2013

SNMP OID for disks

# snmpwalk -v 3 -l AuthNoPriv -u cactiadmin -A <password> <hostname>  .1.3.6.1.2.1.25.2.3.1
HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1                                                              
HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3                                                              
HOST-RESOURCES-MIB::hrStorageIndex.6 = INTEGER: 6                                                              
HOST-RESOURCES-MIB::hrStorageIndex.7 = INTEGER: 7                                                              
HOST-RESOURCES-MIB::hrStorageIndex.8 = INTEGER: 8                                                              
HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10                                                            
HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31                                                            
HOST-RESOURCES-MIB::hrStorageIndex.32 = INTEGER: 32                                                            
HOST-RESOURCES-MIB::hrStorageIndex.33 = INTEGER: 33                                                            
HOST-RESOURCES-MIB::hrStorageIndex.34 = INTEGER: 34                                                            
HOST-RESOURCES-MIB::hrStorageIndex.35 = INTEGER: 35                                                            
HOST-RESOURCES-MIB::hrStorageIndex.36 = INTEGER: 36                                                            
HOST-RESOURCES-MIB::hrStorageIndex.37 = INTEGER: 37                                                            
HOST-RESOURCES-MIB::hrStorageIndex.38 = INTEGER: 38                                                            
HOST-RESOURCES-MIB::hrStorageIndex.39 = INTEGER: 39                                                            
HOST-RESOURCES-MIB::hrStorageIndex.40 = INTEGER: 40                                                            
HOST-RESOURCES-MIB::hrStorageIndex.41 = INTEGER: 41                                                            
HOST-RESOURCES-MIB::hrStorageIndex.42 = INTEGER: 42                                                            
HOST-RESOURCES-MIB::hrStorageIndex.43 = INTEGER: 43                                                            
HOST-RESOURCES-MIB::hrStorageIndex.44 = INTEGER: 44                                                            
HOST-RESOURCES-MIB::hrStorageIndex.45 = INTEGER: 45                                                            
HOST-RESOURCES-MIB::hrStorageType.1 = OID: HOST-RESOURCES-TYPES::hrStorageRam                                  
HOST-RESOURCES-MIB::hrStorageType.3 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory                        
HOST-RESOURCES-MIB::hrStorageType.6 = OID: HOST-RESOURCES-TYPES::hrStorageOther                                
HOST-RESOURCES-MIB::hrStorageType.7 = OID: HOST-RESOURCES-TYPES::hrStorageOther                                
HOST-RESOURCES-MIB::hrStorageType.8 = OID: HOST-RESOURCES-TYPES::hrStorageOther                                
HOST-RESOURCES-MIB::hrStorageType.10 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory                       
HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk                           
HOST-RESOURCES-MIB::hrStorageType.32 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk                           
HOST-RESOURCES-MIB::hrStorageType.33 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk                           
HOST-RESOURCES-MIB::hrStorageType.34 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk                           
HOST-RESOURCES-MIB::hrStorageType.35 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk                           
HOST-RESOURCES-MIB::hrStorageType.36 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.37 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.38 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.39 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.40 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.41 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.42 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.43 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.44 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageType.45 = OID: HOST-RESOURCES-TYPES::hrStorageNetworkDisk                         
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory                                                 
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory                                                  
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers                                                  
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory                                                   
HOST-RESOURCES-MIB::hrStorageDescr.8 = STRING: Shared memory                                                   
HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space                                                     
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /                                                              
HOST-RESOURCES-MIB::hrStorageDescr.32 = STRING: /dev                                                           
HOST-RESOURCES-MIB::hrStorageDescr.33 = STRING: /boot/efi                                                      
HOST-RESOURCES-MIB::hrStorageDescr.34 = STRING: /dbfs                                                          
HOST-RESOURCES-MIB::hrStorageDescr.35 = STRING: /sys/fs/fuse/connections                                       
HOST-RESOURCES-MIB::hrStorageDescr.36 = STRING: /scandoc                                                       
HOST-RESOURCES-MIB::hrStorageDescr.37 = STRING: /data1                                                         
HOST-RESOURCES-MIB::hrStorageDescr.38 = STRING: /data2                                                         
HOST-RESOURCES-MIB::hrStorageDescr.39 = STRING: /data3                                                         
HOST-RESOURCES-MIB::hrStorageDescr.40 = STRING: /data4                                                         
HOST-RESOURCES-MIB::hrStorageDescr.41 = STRING: /data5                                                         
HOST-RESOURCES-MIB::hrStorageDescr.42 = STRING: /data6                                                         
HOST-RESOURCES-MIB::hrStorageDescr.43 = STRING: /data7                                                         
HOST-RESOURCES-MIB::hrStorageDescr.44 = STRING: /data8                                                         
HOST-RESOURCES-MIB::hrStorageDescr.45 = STRING: /mnt                                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 1024 Bytes                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.6 = INTEGER: 1024 Bytes                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.7 = INTEGER: 1024 Bytes                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.8 = INTEGER: 1024 Bytes                                           
HOST-RESOURCES-MIB::hrStorageAllocationUnits.10 = INTEGER: 1024 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 4096 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.32 = INTEGER: 4096 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.33 = INTEGER: 4096 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.34 = INTEGER: 4096 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.35 = INTEGER: 4096 Bytes                                          
HOST-RESOURCES-MIB::hrStorageAllocationUnits.36 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.37 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.38 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.39 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.40 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.41 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.42 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.43 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.44 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageAllocationUnits.45 = INTEGER: 1048576 Bytes                                       
HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 12155540                                                        
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 14259856                                                        
HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER: 12155540                                                        
HOST-RESOURCES-MIB::hrStorageSize.7 = INTEGER: 4839032                                                         
HOST-RESOURCES-MIB::hrStorageSize.8 = INTEGER: 0                                                               
HOST-RESOURCES-MIB::hrStorageSize.10 = INTEGER: 2104316                                                        
HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 59534244                                                       
HOST-RESOURCES-MIB::hrStorageSize.32 = INTEGER: 1519442
HOST-RESOURCES-MIB::hrStorageSize.33 = INTEGER: 39892
HOST-RESOURCES-MIB::hrStorageSize.34 = INTEGER: 120180154
HOST-RESOURCES-MIB::hrStorageSize.35 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageSize.36 = INTEGER: 1400856
HOST-RESOURCES-MIB::hrStorageSize.37 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.38 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.39 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.40 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.41 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.42 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.43 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.44 = INTEGER: 1393359
HOST-RESOURCES-MIB::hrStorageSize.45 = INTEGER: 534204
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 11836056
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 11849536
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 235324
HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 4839032
HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 13480
HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 50409441
HOST-RESOURCES-MIB::hrStorageUsed.32 = INTEGER: 48
HOST-RESOURCES-MIB::hrStorageUsed.33 = INTEGER: 2984
HOST-RESOURCES-MIB::hrStorageUsed.34 = INTEGER: 47065623
HOST-RESOURCES-MIB::hrStorageUsed.35 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.36 = INTEGER: 1256834
HOST-RESOURCES-MIB::hrStorageUsed.37 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.38 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.39 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.40 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.41 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.42 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.43 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.44 = INTEGER: 947160
HOST-RESOURCES-MIB::hrStorageUsed.45 = INTEGER: 497161

Tuesday, August 20, 2013

MIT Kerberos 5 Survives (SuSE Linux)

Start Kerberos Admin Shell
# kadmin.local
kadmin> listprincs

Create a principal
kadmin> ank articy

Create another principal named articy/admin,
kadmin> ank articy/admin


Assign kerberos admin role to articy/admin
add below entry into /var/lib/kerberos/krb5kdc/kadm5.acl

 articy/admin       *

restart Kerberos and its admin service
service kadmind  restart
service kbd restart

Start kadmin shell
# kadmin -p articy/admin
kadmin> listprincs

Create a principal for machine:
kadmin> ank -randkey host/was.goweekend.ca@GOWEEKEND.CA

Extract the key for the host principal to a keytab file
kadmin> ktadd -k /var/tmp/was.goweekend.ca.keytab host/was.goweekend.ca

Monday, August 19, 2013

Configure Linux to use LDAP Server to use LDAP to authenticate


Install packages required


pam_ldap-32bit
pam_ldap
nss_ldap-32bit
nss_ldap

Authentication Methods

change /etc/nsswitch.conf to use local file and ldap
passwd: compat


and append below entry

passwd_compat:  ldap

User credential

/etc/passwd

append below entry to passwd
+::::::

/etc/shadow

append below entry to shadow
+::0:0:0::::

LDAP Information

/etc/ldap.conf
base    dc=goweekend,dc=ca
bind_policy     soft
pam_lookup_policy       yes
pam_password    exop
nss_initgroups_ignoreusers      root,ldap
nss_schema      rfc2307bis
nss_map_attribute       uniqueMember member
ssl     no
uri     ldap://ldap.goweekend.ca
ldap_version    3
pam_filter      objectClass=posixAccount

Thursday, August 15, 2013

Oracle Database connection using Oracle Wallet


Oracle Wallet protects your oracle database user credential by password, it means, Oracle wallet creates a secured credential store, and sqlplus reads the credentials from the store to connect to specified database.

To use it, you need Oracle database client.


In $ORACLE_HOME/bin, mkstore can be found. If you prefer to GUI, type owm from unix console.

user: root
DB User: SCOTT
SID: TEST


1. Create .sqlnet.ora in /root with below entries

SQLNET.WALLET_OVERRIDE=TRUE
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/root)))
 
2. Create Oracle Wallet in /root
# mkstore -create -wrl /root
Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.

Enter password:

Enter password again:

3. Add credentials
Syntax:  mkstore -wrl /root -createCredential <ORACLE_SID> scott

# mkstore -wrl /root -createCredential TEST scott
Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.

Your secret/Password is missing in the command line
Enter your secret/Password:

Re-enter your secret/Password:

Enter wallet password:

Create credential oracle.security.client.connect_string1
4. Verify the setting

# sqlplus /@TEST

SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 15 11:56:51 2013

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


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

SQL> show user
USER is "SCOTT"
SQL>

Other usefull commands to help you troubleshoot

# mkstore -wrl /root -list
# mkstore -wrl /root -viewEntry oracle.security.client.connect_string1
# mkstore -wrl /root -viewEntry oracle.security.client.username1
# mkstore -wrl /root -viewEntry oracle.security.client.password1

Reference: http://docs.oracle.com/cd/B28359_01/network.111/b28530/asowalet.htm




Wednesday, August 14, 2013

Openldap Installation and Configuration on SuSE Linux 11

Use Yast(2) to install openldap server and client, I am using  version 2-2.4.26-0.12.1 in this case.

Installation

Here, I am not explain the installation in details.

1. Check LDAP, LDAP over SSL, and LDAP over IPC, if you are not using yast2, you might be able to change the options in ldap configuration files.


Configuration


base    dc=office,dc=goweekend,dc=ca
uri     ldap://ldap.office.goweekend.ca
surfix dc=office,dc=goweekend,dc=ca
Administrator DN cn=Administrator,dc=office,dc=goweekend,dc=ca



restart ldap service
# service ldap restart

Population

Add your own schema

Add your own schema if necessary, if not, you can skip this section to load your groups/users.

you can refer to /etc/openldap/schema/core.ldif to [rrepare your own schema. You can register your own OID from Internet Assigned Numbers Authority (IANA) by filling out the registration form http://pen.iana.org/pen/PenApplication.page, to check your existing OID number, go to page http://www.iana.org/assignments/enterprise-numbers/enterprise-numbers.

 Or, you can dump existing schema from your existing ldap server by following below procedure. For instance, mylocal.schema
Find the included schema in slapd.conf, and copy those entries to /var/tmp/dump.conf

include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/rfc2307bis.schema
include         /etc/openldap/schema/yast.schema
include         /etc/openldap/schema/mylocal.schema

  1. Login into a Linux server which can connect to existing ldap server
  2. create /var/tmp/dump.conf
    include         /etc/openldap/schema/core.schema
    include         /etc/openldap/schema/cosine.schema
    include         /etc/openldap/schema/inetorgperson.schema
    include         /etc/openldap/schema/rfc2307bis.schema
    include         /etc/openldap/schema/yast.schema
    include         /etc/openldap/schema/mylocal.schema
  3. create folder /var/tmp/schema_dump
    # mkdir -p /var/tmp/schema_dump
  4. dump schema
    # slaptest -f /var/tmp/dump.conf -F /var/tmp/schema_dump
  5.  copy the dump to new ldap server by scp, ftp ..., but I prefer tar and ssh
    # tar -cf - /var/tmp/schema_dump | ssh ldap.office.goweekend.ca "cd /; tar -xf -"
  6. modify /var/tmp/schema_dump/cn=config/cn=schema/cn={5}mylocal.ldif on new ldap server
    Fromto
    dn: cn={5}mylocal,cn=schema,cn=config
    cn: {5}mylocalmylocal

    and remove below entries from the end
    structuralObjectClass:
    entryUUID:
    creatorsName:
    createTimestamp:
    entryCSN:
    modifiersName: cn=config
    modifyTimestamp:
  7. load your schema
    # ldapadd -Y EXTERNAL -H ldapi:/// -f /var/tmp/schema_dump/cn\=config/cn\=schema/cn\=\{5\}mylocal.ldif

Load groups and users

Groups

# cat group.ldif
dn: cn=administrators,dc=office,dc=goweekend,dc=ca
objectClass: groupofnames
objectClass: top
cn: administrators
member: cn=Administrator,dc=office,dc=goweekend,dc=ca


# ldapadd -h ldap.office.goweekend.ca -D "cn=Administrator,dc=office,dc=goweekend,dc=ca" -W -f group.ldif

to verify
# ldapsearch -h ldap.office.goweekend.ca -D "cn=Administrator,dc=office,dc=goweekend,dc=ca" -W '(cn=administrators)'
# extended LDIF
#
# LDAPv3
# base <dc=office,dc=goweekend,dc=ca> (default) with scope subtree
# filter: (cn=administrators)
# requesting: ALL
#

# administrators, goweekend.ca
dn: cn=administrators,dc=office,dc=goweekend,dc=ca
objectClass: groupOfNames
objectClass: top
cn: administrators
member: cn=Administrator,dc=office,dc=goweekend,dc=ca

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1


Users

# cat tomcatt.ldif
dn: cn=Tom Catt,dc=office,dc=goweekend,dc=ca
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
cn: Tom Catt
sn: Catt
uid: tomcatt
givenName: Tom
mail: tomcatt@goweekend.ca
postalAddress: 1 Yonge St., North Pole, Canada
postalCode: H0H 0H0
telephoneNumber: 111-111-1111
title: Santa
userPassword:: RjFyc3RDMHQ=

# ldapadd -h ldap.office.goweekend.ca -D "cn=Administrator,dc=office,dc=goweekend,dc=ca" -W -f tomcatt.ldif


to verify


# ldapsearch -h ldap.office.goweekend.ca -D "cn=Administrator,dc=office,dc=goweekend,dc=ca" -W '(cn=Tom Catt)'
# extended LDIF
#
# LDAPv3
# base <dc=office,dc=goweekend,dc=ca> (default) with scope subtree
# filter: (cn=Tom Catt)
# requesting: ALL
#

# Tom Catt, goweekend.ca
dn: cn=Tom Catt,dc=office,dc=goweekend,dc=ca
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
cn: Tom Catt
sn: Catt
uid: tomcatt
givenName: Tom
mail: tomcatt@goweekend.ca
postalAddress: 1 Yonge St., North Pole, Canada
postalCode: H0H 0H0
telephoneNumber: 111-111-1111
title: Santa
userPassword:: RjFyc3RDMHQ=

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1






Monday, August 12, 2013

Oracle 10g: Reconfigure Enterprise Manager


Remove existing Enterprise Manager Configuration and Repository
$ emca -deconfig dbcontrol db -repos drop

Configure Enterprise Manager
$ emca -config dbcontrol db -repos create

If Enterprise Manager failed to start, Check the log file, and if it is certificate relater, try to unsecure enterprise manager

If existing Enterprise Manager is running, you need stop it first

$ emctl stop agent
$ emctl stop dbconsole

Sometime, the agent/dbconsole cannot be stopped properly, you have to find the process and kill them.

For example,

When you try to stop dbconsole, it says:
Stopping Oracle Enterprise Manager 10g Database Control ...
--- Failed to shutdown DBConsole Gracefully ---
failed.

but when you try to find dbconsole status, it reads:
Oracle Enterprise Manager 10g is not running.

try to start it, it reads:
An instance of Oracle Enterprise Manager 10g Database Control is already running.

but if you can find its port number, you can run below perl file to find out who is using the port number, and kill it.

below scripts is quoted from internet, and don't have the writer's name

cat portuser.pl

#! /usr/bin/env perl
##
## Search the processes which are listening on the given port.
##
## For SunOS 5.10.
##

use strict;
use warnings;

die "Port missing" unless $#ARGV >= 0;
my $port = int($ARGV[0]);
die "Invalid port" unless $port > 0;

my @pids;
map { push @pids, $_ if $_ > 0; } map { int($_) } `ls /proc`;

foreach my $pid (@pids) {
    open (PF, "pfiles $pid 2>/dev/null |")
        || warn "Can not read pfiles $pid";
    $_ = <PF>;
    my $fd;
    my $type;
    my $sockname;
    my $peername;
    my $report = sub {
        if (defined $fd) {
            if (defined $sockname && ! defined $peername) {
                print "$pid $type $sockname\n"; } } };
    while (<PF>) {
        if (/^\s*(\d+):.*$/) {
            &$report();
            $fd = int ($1);
            undef $type;
            undef $sockname;
            undef $peername; }
        elsif (/(SOCK_DGRAM|SOCK_STREAM)/) { $type = $1; }
        elsif (/sockname: AF_INET[6]? (.*)  port: $port/) {
            $sockname = $1; }
        elsif (/peername: AF_INET/) { $peername = 1; } }
    &$report();
    close (PF); }

$ perl portuser.pl 5503
9303 SOCK_STREAM 0.0.0.0

Verify with pargs

$ pargs 9303
9303:   /app/oracle/product/10.2.0.1/jdk/bin/java -server -Xmx256M -XX:MaxPermSize
argv[0]: /app/oracle/product/10.2.0.1/jdk/bin/java
argv[1]: -server
argv[2]: -Xmx256M
argv[3]: -XX:MaxPermSize=96m
argv[4]: -XX:MinHeapFreeRatio=20
argv[5]: -XX:MaxHeapFreeRatio=40
argv[6]: -DORACLE_HOME=/app/oracle/product/10.2.0.1
argv[7]: -Doracle.home=/app/oracle/product/10.2.0.1/oc4j
argv[8]: -Doracle.oc4j.localhome=/app/oracle/product/10.2.0.1/db.goweekend.ca_WEND/sysman
argv[9]: -DEMSTATE=/app/oracle/product/10.2.0.1/db.goweekend.ca_WEND
argv[10]: -Doracle.j2ee.dont.use.memory.archive=true
argv[11]: -Djava.protocol.handler.pkgs=HTTPClient
argv[12]: -Doracle.security.jazn.config=/app/oracle/product/10.2.0.1/oc4j/j2ee/OC4J_DBConsole_db.goweekend.ca_WEND/config/jazn.xml
argv[13]: -Djava.security.policy=/app/oracle/product/10.2.0.1/oc4j/j2ee/OC4J_DBConsole_db.goweekend.ca_WEND/config/java2.policy
argv[14]: -Djava.security.properties=/app/oracle/product/10.2.0.1/oc4j/j2ee/home/config/jazn.security.props
argv[15]: -DEMDROOT=/app/oracle/product/10.2.0.1/db.goweekend.ca_WEND
argv[16]: -Dsysman.md5password=true
argv[17]: -Drepapi.oracle.home=/app/oracle/product/10.2.0.1
argv[18]: -Ddisable.checkForUpdate=true
argv[19]: -Djava.awt.headless=true
argv[20]: -jar
argv[21]: /app/oracle/product/10.2.0.1/oc4j/j2ee/home/oc4j.jar
argv[22]: -config
argv[23]: /app/oracle/product/10.2.0.1/oc4j/j2ee/OC4J_DBConsole_db.goweekend.ca_WEND/config/server.xml

$ kill -9 9303

$ ps -ef | grep -i emagent
oracle  9535  9298   0 09:24:09 pts/2       0:15 /usr2/app/oracle/product/10.2.0.1/bin/emagent

$ kill -9 9535


$ emctl unsecure dbconsole

You may force to clean up EM, please check http://feijiangnan.blogspot.ca/2013/06/oracle-reconfigure-em-after-hostname.html


Friday, August 9, 2013

Confiture Proxy for Maven

Configure proxy for Maven

Generate encrypted master password, and put it in ~/.m2/settings-security.xml
# mvn --encrypt-master-password think4me
{OtIRlSHHxfcHK+Udwxf3m8kVgit3Eqtztqy2ObbsZ/U=}

# cat settings-security.xml
<settingsSecurity>
  <master>{zvjuoGQr1jkHdkuZFFoQP1cmTyihJTPbKXsX5f1uCfc=}</master>
</settingsSecurity>

# mvn --encrypt-password proxyPassword
{sCFw33fLXuAHU4q3SPKxr4SOhztESnlpNnDmPT6Mk9s=}

Put the encrypted password in ~/.m2/settings.xml

# cat settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>

  <proxies>
    <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyclient</username>
      <password>{sCFw33fLXuAHU4q3SPKxr4SOhztESnlpNnDmPT6Mk9s=}</password>
      <port>8888</port>
      <host>proxy.goweekend.ca</host>
      <nonProxyHosts/>
      <id>myproxy</id>
    </proxy>
  </proxies>
</settings>

test proxy
Create application
# mvn archetype:generate -DgroupId=com.goweekend.helloworld -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Upgrade Oracle Database 10g to 11g

Prerequisites Check

Run the Pre-Upgrade Information Tool for Collecting Pre-Upgrade Information

Step 1
      Log in to the system as the owner of the Oracle Database 11g Release 2 (11.2) Oracle Home directory.
      Copy the Pre-Upgrade Information Tool (utlu112i.sql) from the Oracle Database 11g Release 2 (11.2) ORACLE_HOME/rdbms/admin directory to a directory outside of the Oracle Home, such as the temporary directory on your system.
      $ORACLE_HOME/rdbms/admin/utlu112i.sql
Step 2
      Change to the directory where utlu112i.sql had been copied in the previous step.
      Start SQL*Plus and connect to the database instance as a user with SYSDBA privileges. Then run and spool the utlu112i.sql file. Please note that the database should be started using the Source Oracle Home.
$ sqlplus '/ as sysdba'
SQL> spool upgrade_info.log
SQL> @utlu112i.sql
SQL> spool off
Check the spool file and examine the output of the Upgrade Information Tool.

Remove Public SYNONYM XMLCONCAT

$ sqlplus / as sysdba
SQL> select SYNONYM_NAME,OWNER from all_synonyms where SYNONYM_NAME = 'XMLCONCAT';
SQL> drop public synonym XMLCONCAT;
Synonym dropped.

Improve upgrade performance

To decrease the amount of downtime incurred when collecting statistics, you can collect statistics prior to performing the actual database upgrade. As of Oracle Database 10g Release 1 (10.1), Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS procedure to gather these statistics. For example, you can enter the following:
$ sqlplus "/as sysdba"
SQL> EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

Recompile Invalid Objects at least twice

$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus "/ as sysdba"
SQL> @utlrp.sql

Upgrading

Starting Upgrade Using DBUA:
Enter the following command at a system prompt in the Oracle Database 11g Release 2 (11.2.0.x) environment:
Make sure that you are invoking the DBUA utility from the target Oracle home only .
Login as oracle user,
$ dbua

Follow the instructions in DBUA to finish upgrade without Upgrading Enterprise Manager, it will be reconfigured.

Post Upgrading

Change parameters for new Instance


mkdir -p /usr2/app/oracle/product/11.2.0.3/admin/<DBINSTANCE>/adump
mkdir -p $ORACLE_HOME/admin/<DBINSTANCE>/cdump
SQL> show parameter core_dump_dest
SQL> alter system set core_dump_dest='/usr2/app/oracle/product/11.2.0.3/admin/<DBINSTANCE>/cdump' scope=both;
SQL> show parameter audit
SQL> alter system set audit_file_dest='/usr2/app/oracle/product/11.2.0.3/admin/<DBINSTANCE>/adump' scope=spfile;
SQL> show parameter DB_RECOVERY_FILE_DEST
SQL> alter system set db_recovery_file_dest='/usr2/app/oracle/product/11.2.0.3/flash_recovery_area/<DBINSTANCE>' scope=both;
SQL> show parameter compatible;
SQL> ALTER SYSTEM SET COMPATIBLE = '11.2.0' SCOPE=spfile;

Change LOG_MODE

$ cd $ORACLE_HOME/dbs
$ orapwd file=orapw<DBINSTANCE> entries=10
$ sqlplus / as sysdba
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG

QL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1820540928 bytes
Fixed Size                  2229304 bytes
Variable Size             452987848 bytes
Database Buffers         1358954496 bytes
Redo Buffers                6369280 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.

Enable Audit Feature (Optional)

Login as sysdba
$ sqlplus / as sysdba
SQL> alter system set audit_trail = 'DB_EXTENDED';
SQL> shutdown immediate
SQL> startup

References

Complete Checklist to Upgrade the Database to 11gR2 using DBUA [ID 870814.1]
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=481180426703885&id=870814.1&_afrWindowMode=0&_adf.ctrl-state=mqfm1zxvp_311

Friday, August 2, 2013

Java UI Development


http://www.tutorialspoint.com/jsf/jsf_quick_guide.htm

WAS and SAML

WebSphere Application Server supports SAML client plody set bindings with SAML since V7.0.0.7.

 Reference:

V7: http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.was_v7/was/7.0.0.7/SAML.html

V8:
https://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.was_v8/was/8.0/Security/WASV8_SAML.pdf
 
Understanding the WebSphere Application Server SAML Trust Association Interceptor
http://www.ibm.com/developerworks/websphere/techjournal/1307_lansche/1307_lansche.html

Thursday, August 1, 2013

Extending Net-SNMP with NetSNMP::agent



https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sect-System_Monitoring_Tools-Net-SNMP-Extending.html