Wednesday, July 31, 2013

Cognos: Unattended Installation

===============================================================================================
Cognos
./issetupnx -s /net/todnfs03/vol/archive/sw_archive/cognos/response.ats

===============================================================
cd /etc; find . -name "*WAS*" -exec rm -f {} \;

=====================================================================================
Cognos

Oracle 11g: Delete archive log

Case:
Database Instance cannot startup

 SQL> startup
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2228704 bytes
Variable Size            1291849248 bytes
Database Buffers          268435456 bytes
Redo Buffers                7495680 bytes
Database mounted.                      
ORA-03113: end-of-file on communication channel
Process ID: 13150                            
Session ID: 191 Serial number: 3             

check alter_<instance anme>.log

ORA-19815: WARNING: db_recovery_file_dest_size of 10737418240 bytes is 100.00% used, and has 0 remaining bytes available.

Startup DB instance in restrict mode

$ sqlplus / as sysdba
SQL> startup mount exclusive restrict

SQL> show parameter db_recovery_file%

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /usr2/app/oracle/fast_recovery_area
db_recovery_file_dest_size           big integer 10G

Open another console, and check the file size in /usr2/app/oracle/fast_recovery_area

Run RMAN to clean up archive logs
 RMAN nocatalog target / < <EOF
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
EOF
project.class.path
to force to delete archivelog
RMAN> delete noprompt force archivelog all;

Restart Databaes Instance
SQL> shutdown
SQL> startup







Tuesday, July 30, 2013

SAS: Promote Portal Application Tree

After Moving Content from Source to Destination, Information Delivery Portal doesn't work. It redirects your request to blank page after login.

Cause:
the moving process failed to import "Portal Application Tree" because Portal Application Tree has configuration issue. but brm doesn't report the error.

Solution:
when you manually import "Portal Application Tree" from source, the command shows problem at end if it failed. You can find clues from Portal Application Tree xml files extracted from source SAS, and fix the problem. then redo it.


Reference:
http://support.sas.com/documentation/cdl/en/biwaag/63149/HTML/default/viewer.htm#a003370494.htm

SAS: Move Content with BRM

1.Customize brm.properties and brm-log4j.properties on Source SAS Server
2. Run brm backup command to back up solutions content on source server
    c:\BRM> brm backup
    or
    # > ./brm.sh backup

3.Customize brm.properties and brm-log4j.properties on Destination SAS Server

4. Run brm backup command to back up solutions content on destination server

    c:\BRM> brm backup
    or
    # > ./brm.sh backup

5. Run brm saveconfig command to back up solutions content on destination server

    c:\BRM> brm saveconfig
    or
    # > ./brm.sh saveconfig

6. Run brm restore on the destination server
    on Windows:
    brm restore \\machinename\sharename\BRM-backup-dir
    on Unix
    ./brmrunas.sh sassrv restore /export/machinename/sharename/BRM-backup-dir

 7. Run brm loadconfig on destination server
    on Windows:
    brm loadconfig
    on Unix
    ./brmrunas.sh loadconfig

8. Restart all servers

9. Refresh SAS BI Web Services
    on Windows:
    brm refreshservices
    on Unix
    ./brmrunas.sh refreshservices

10. Refresh URLs in SAS BI Dashboard Indicator
    on Windows:
    brm indicators
    on Unix
    ./brmrunas.sh indicators

11. Restart All Servers

Friday, July 19, 2013

Oracle 11g: trace apply stream


trace apply stream

1.Stop the apply:(DBMS_APPLY_ADM.STOP_APPLY)
2. alter system set events '1349 trace name context forever , level 1024';
3.exec dbms_apply_adm.set_parameter('APPLY_NAME','trace_level',127);
4.Start the apply
5.alter system set events='1349 trace name context off' ;
6.exec dbms_apply_adm.set_parameter('APPLY_NAME','trace_level',null);

Monday, July 15, 2013

Solaris PS


to show full command
/usr/ucb/ps -auxw

or with specified PID
 /usr/ucb/ps -auxwww 5709

pargs - print  process  arguments,  environment   variables, or auxiliary vector

pargs 5709

Friday, July 12, 2013

Java: sample code to run system command from servlet

package my.application.helloWorld;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HelloWorldServlet
 */
@WebServlet("/HelloWorldServlet")
public class HelloWorldServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public HelloWorldServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        // response.getOutputStream().println("Hello World at " + (new
        // Date()).toString());

        try {
            Runtime rt = Runtime.getRuntime();

            Process pr = rt.exec("ls");

            BufferedReader input = new BufferedReader(new InputStreamReader(
                    pr.getInputStream()));

            String line = null;
            response.getOutputStream().println("Hellow World!");

            while ((line = input.readLine()) != null) {
                response.getOutputStream().println(line);

            }

            int exitVal = pr.waitFor();
            response.getOutputStream().println("This is Exited with error code " + exitVal);

        } catch (Exception e) {
            response.getOutputStream().println(e.toString());
            e.printStackTrace();
        }
    }

    public static void executeShellCommand( String command ) throws InterruptedException, IOException {
        Runtime.getRuntime().exec( command.split( " " ) ).waitFor();
      }
   
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

}

Oracle: Drop Database

ORACLE_SID=TESTSID; export ORACLE_SID
sqlplus /nolog << ENDSQLDBA
connect / as sysdba
startup mount exclusive restrict;
drop database;
exit
ENDSQLDBA

Virtual Box Journal

Convert dd image to VDI

vboxmanage convertfromraw ssm.img /ssm/ssm.vdi --format VDI

Monday, July 8, 2013

SNMP: on Solaris

Oracle Solaris 11

# svcadm enable svc:/application/management/net-snmp:default
# svcadm stop svc:/application/management/net-snmp:default

# vi /etc/net-snmp/snmp/snmpd.conf

Oracle Solaris 10
# vi /etc/sma/snmp/snmpd.conf
syslocation Toronto
syscontact Sysadmin (aniu@goweekend.ca)

# SNMP v3

createUser cactiadmin MD5 think4me DES
group groupv3             usm      cactiadmin
view    all included   .iso      80
access groupv3         ""        any       auth      exact    all         all        all

 
# svcadm restart svc:/application/management/sma:default
#  snmpget -v 3 -l AuthNoPriv -u cactiadmin -A <password> 137.15.20.7 sysName.0

SNMPv2-MIB::sysName.0 = STRING: taihu.goweekend.ca



Example for ZFS Monitoring

syslocation NewYork
syscontact Sysadmin ()



# SNMP v3

createUser cacti MD5 password DES
group groupv3             usm      cactiuser
view    all included   .iso      80
access groupv3         ""        any       auth      exact    all         all        all

extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "zpool list -H -o name"
extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}';done"
extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "zpool list -Ho name|xargs zfs get -Hp -o value used"
extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do snap=`zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`zfs get -Hp -o value used $zpool`; echo $pool $snap|awk '{print (\$1-\$2);}';done"
extend .1.3.6.1.4.1.2021.88 zpool_available /bin/bash -c "zpool list -Ho name|xargs zfs get -Hp -o value available"
extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "zpool list -H -o capacity"

 

WebSphere: Generating Dumps

using WSAdmin script

Create Java Core Dump
$ vi javacoredump.py

def generateThreadDump(serverName):
   serverJVM = AdminControl.queryNames("type=JVM,process="+serverName+",*")
   AdminControl.invoke(serverJVM,"dumpThreads")

generateThreadDump("server1") 



$  /opt/IBM/WebSphere/AppServer/profiles/AppSrv/bin/wsadmin.sh -lang jython -f javacoredump.py

$ ls -lrt  /opt/IBM/WebSphere/AppServer/profiles/AppSrv

 -rw-r--r--  1 root root 7126921 2013-07-08 12:57 javacore.20130708.125741.19269.0001.txt

=================================================================================

Create Heapdump

$ vi heapdump.py
def generateThreadDump(serverName):
  serverJVM = AdminControl.queryNames("type=JVM,process="+serverName+",*")
  AdminControl.invoke(serverJVM,"generateHeapDump")

generateThreadDump("server1")
 

$  /opt/IBM/WebSphere/AppServer/profiles/AppSrv/bin/wsadmin.sh -lang jython -f heapdump.py

$ ls -lrt  /opt/IBM/WebSphere/AppServer/profiles/AppSrv
-rw-r--r--  1 root root 94183104 2013-07-08 13:18 heapdump.20130708.131755.19269.0002.phd



Getting Heapdumps on the Solaris platform
http://www-01.ibm.com/support/docview.wss?uid=swg21242314