Wednesday, November 30, 2011

ldd

NAME
ldd - print shared library dependencies
ldd `which svn`

reference
http://old.nabble.com/svn-error,-cannot-find-libsvn_client-1.so.0-td23407998.html

svn

--subversion is a tool for version control

svn --version #check version
svn help # find help for command

svn checkout (co)
svn update (up)

change password with harsh value in oracle 11g

1. get ddl to recreate the user.
select dbms_metadata.get_ddl('USER','COSKAN') from dual;

Attn: set long 200 if you read in sqlplus

example of results:
DBMS_METADATA.GET_DDL('USER','COSKAN') ------------------------------------------------------------------------------------------------------------------------------------

CREATE USER "COSKAN" IDENTIFIED BY
VALUES 'S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA;26EB15F771A78542'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"

2. check hash value from sys.user$
select password, spare4 from sys.user$ where name = 'COSKAN';

alter system set sec_case_sensitive_logon=true;

S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA -- for sensitive
26EB15F771A78542 -- for non-sensitive

if set up only non-sensitive, sec_case_sensitive_logon=true will not work.

3. change password
alter user "COSKAN" IDENTIFIED BY
VALUES 'S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA;26EB15F771A78542';

4. practical use
if you need extend an expired account, the only way I know is to change user to default profile and reset password with harsh value (if you don't know what it is)
then change back to previous profile.



reference:
http://riaschissl.blogspot.com/2010/07/oracle-unexpire-and-unlock-accounts.html
http://coskan.wordpress.com/2009/03/11/alter-user-identified-by-values-on-11g-without-using-sysuser/

ps

SYNOPSIS
ps [options]

DESCRIPTION
ps displays information about a selection of the active processes. If you want a repetitive update of the
selection and the displayed information, use top(1) instead.

This version of ps accepts several kinds of options:
1 UNIX options, which may be grouped and must be preceded by a dash.
2 BSD options, which may be grouped and must not be used with a dash.
3 GNU long options, which are preceded by two dashes.

Options of different types may be freely mixed, but conflicts can appear. There are some synonymous options, which
are functionally identical, due to the many standards and ps implementations that this ps is compatible with.

Note that "ps -aux" is distinct from "ps aux". The POSIX and UNIX standards require that "ps -aux" print all
processes owned by a user named "x", as well as printing all processes that would be selected by the -a option. If
the user named "x" does not exist, this ps may interpret the command as "ps aux" instead and print a warning. This
behavior is intended to aid in transitioning old scripts and habits. It is fragile, subject to change, and thus
should not be relied upon.

By default, ps selects all processes with the same effective user ID (euid=EUID) as the current user and
associated with the same terminal as the invoker. It displays the process ID (pid=PID), the terminal associated
with the process (tname=TTY), the cumulated CPU time in [dd-]hh:mm:ss format (time=TIME), and the executable name
(ucmd=CMD). Output is unsorted by default.

The use of BSD-style options will add process state (stat=STAT) to the default display and show the command args
(args=COMMAND) instead of the executable name. You can override this with the PS_FORMAT environment variable. The
use of BSD-style options will also change the process selection to include processes on other terminals (TTYs)
that are owned by you; alternately, this may be described as setting the selection to be the set of all processes
filtered to exclude processes owned by other users or not on a terminal. These effects are not considered when
options are described as being "identical" below, so -M will be considered identical to Z and so on.

Except as described below, process selection options are additive. The default selection is discarded, and then
the selected processes are added to the set of processes to be displayed. A process will thus be shown if it meets
any of the given selection criteria.

EXAMPLES
To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
ps -ely

To see every process on the system using BSD syntax:
ps ax
ps axu

To print a process tree:
ps -ejH
ps axjf

To get info about threads:
ps -eLf
ps axms

To get security info:
ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM

To see every process running as root (real & effective ID) in user format:
ps -U root -u root u

To see every process with a user-defined format:
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
ps -eopid,tt,user,fname,tmout,f,wchan

Print only the process IDs of syslogd:
ps -C syslogd -o pid=

Print only the name of PID 42:
ps -p 42 -o comm=

nslookup

nslookup 192.168.1.2
nslookup name.col.com


Non-interactive mode is used when the name or Internet address of the host to be looked up is given as the first
argument. The optional second argument specifies the host name or address of a name server.

refresh materialized view in oracle

1. procedure to execute
REFRESH Procedures
This procedure refreshes a list of materialized views.

Syntax

DBMS_MVIEW.REFRESH (
{ list IN VARCHAR2,
| tab IN DBMS_UTILITY.UNCL_ARRAY,}
method IN VARCHAR2 := NULL,
rollback_seg IN VARCHAR2 := NULL,
push_deferred_rpc IN BOOLEAN := true,
refresh_after_errors IN BOOLEAN := false,
purge_option IN BINARY_INTEGER := 1,
parallelism IN BINARY_INTEGER := 0,
heap_size IN BINARY_INTEGER := 0,
atomic_refresh IN BOOLEAN := true,
nested IN BOOLEAN := false);



exec dbms_mview.refresh('schema_owner.mview_name,schema_owner.mview_name1')
exec dbms_mview.refresh('schema_owner.mview_name', atomic_refresh=> fails)
2. refresh methods
a. fast refresh as f
b. complete refresh as c
c. default value can be force ( which try fast if possible otherwise us complete)
3. atomic_refresh parameter.
when you do complete refresh, oracle trancate table and insert /* append */ if atomic_refresh was set false). Oracle will delete and insert if atomic_refresh was set true (which is the default value).

for quick refreseh set atomic_refresh to false.
for data availability , user default value.


reference:
http://askdba.org/weblog/2009/07/mview-complete-refresh-and-atomic_refresh-parameter/
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::p11_question_id:15695764787749
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_mview.htm#i997194

Wednesday, November 16, 2011

oracleasm

oracleasm configure --display current configuration
oracleasm configure -i --change current configuration

oracleasm createdisk diskname /dev/sdb1

oracleasm init --load asm lib driver
oracleasm status -- check asm lib driver status.

active & deactive network interface

ifconfig

ifup

ifdown

network file
/etc/sysconfig/network

network interface file
/etc/sysconfig/network-scripts/ifcfg-eth0


reference: http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

Tuesday, November 15, 2011

xclock

If xclock is missing from you system, install package xorg-x11-apps

yum install xorg-x11-apps

sudo

vi /etc/sudoers
--add
oracle ALL=(ALL) ALL

--to check what sudo privileges current user can run
sudo -l

ssh x11 forward remote display

if you use ssh x11 forwording , you don't need export DISPLAY=remoteserver:0.0.

if you get below error:
Xlib: connection to "localhost:13.0" refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
the cause is the auth line in .Xauthority file is wrong or missing.

if you get below error:
PuTTY X11 proxy: wrong authentication protocol attemptedError: Can't open display: localhost:12.0
the Cause is that you sudo su to the current user.

1. xauth list -- find out want auth line in the file
local/unix:1 MIT-MAGIC-COOKIE-1 8afedf4b9d02e29fff549f534fb8e495
local/unix:13 MIT-MAGIC-COOKIE-1 29230aecd972e2f64dd0973be473f8c2
local/unix:11 MIT-MAGIC-COOKIE-1 c22a518b8ae65a8e2411dda2d561e9ec
local/unix:12 MIT-MAGIC-COOKIE-1 4a3e6c97e72a98a7d5b934127e7c0559
local/unix:10 MIT-MAGIC-COOKIE-1 26ea6ffc0f2704e6df399caff0fccb26

2. xauth remove local/unix:13

3. exit current su user

4. xauth list -- find out initial user login x11 auth line
local/unix:13 MIT-MAGIC-COOKIE-1 4075c2721e69295e62187bb9c8b04b6b

5. su back to user like oracle

6. xauth add local/unix:13 MIT-MAGIC-COOKIE-1 4075c2721e69295e62187bb9c8b04b6b

7. run xclock -- it should appear in your laptop or desktop.
ATTN: if not, check if your laptop or desktop has X-mananger like xing running


reference:
http://froebe.net/blog/2008/11/14/getting-xlib-putty-x11-proxy-wrong-authentication-protocol-attempted-i-have-the-answer/

Monday, November 14, 2011

TNS-12547:TNS:lost contact

this error may caused by permission on /dev/null

if you get "-bash: /dev/null: Permission denied" warning when you login.

the permission of /dev/null may be changed.

it should be set 666

Thursday, November 10, 2011

temp tablespace and usage

V$SORT_SEGMENT

V$TEMP_CACHE_TRANSFER
V$TEMP_EXTENT_MAP
V$TEMP_EXTENT_POOL
V$TEMP_SPACE_HEADER
V$TEMPFILE
V$TEMPORARY_LOBS
V$TEMPSEG_USAGE -- V$sort_usage
V$TEMPSTAT

--create temp tablespace
CREATE TEMPORARY TABLESPACE temp
TEMPFILE '/u02/oradata/TESTDB/temp01.dbf' SIZE 500M REUSE
AUTOEXTEND ON NEXT 100M MAXSIZE 15G
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

-- change default temporary tablespace
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;

-- add more tempfile
alter tablespace temp add tempfile '/u03/oradata/datafile/temp03.dbf' size 100m autoextend on maxsize 15G ;

to find what is going on in a database, check v$sort_usage(v$tempseg_usage) and v$sort_segment

-- list sessoin temporary tablespace usage.

SELECT S.sid || ',' || S.serial# sid_serial, S.username, S.osuser, P.spid, S.module,
P.program, SUM (T.blocks) * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
COUNT(*) statements
FROM v$sort_usage T, v$session S, dba_tablespaces TBS, v$process P
WHERE T.session_addr = S.saddr
AND S.paddr = P.addr
AND T.tablespace = TBS.tablespace_name
GROUP BY S.sid, S.serial#, S.username, S.osuser, P.spid, S.module,
P.program, TBS.block_size, T.tablespace
ORDER BY sid_serial;



-- simplized sessoin temporary tablespace usage.

SELECT S.sid || ',' || S.serial# sid_serial, S.username, T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace, T.sql_id
FROM v$sort_usage T, v$session S, dba_tablespaces TBS
WHERE T.session_addr = S.saddr
AND T.tablespace = TBS.tablespace_name
ORDER BY sid_serial;




-- list temporary tablespace usage.

SELECT A.tablespace_name tablespace, D.mb_total,
SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM v$sort_segment A,
(
SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
FROM v$tablespace B, v$tempfile C
WHERE B.ts#= C.ts#
GROUP BY B.name, C.block_size
) D
WHERE A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total


reference:
http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_3.shtml
http://gavinsoorma.com/2009/06/temp-tablespace-usage/

Wednesday, November 9, 2011

oracle database 11.2.0.3 release patch set 2

Patch 10404530: 11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER

11.2.0.3 Patch Set - List of Bug Fixes by Problem Type [ID 1348303.1]

ALERT: Oracle 11g Release 2 (11.2) Support Status and Alerts [ID 880782.1]

Installation Types and Associated Zip Files
Installation Type Zip File

Oracle Database (includes Oracle Database and Oracle RAC) p10404530_112030_platform_1of7.zip

Note: you must download both zip files to install Oracle Database. p10404530_112030_platform_2of7.zip


Oracle Grid Infrastructure (includes Oracle ASM, Oracle Clusterware, and Oracle Restart) p10404530_112030_platform_3of7.zip

Oracle Database Client p10404530_112030_platform_4of7.zip

Oracle Gateways p10404530_112030_platform_5of7.zip

Oracle Examples p10404530_112030_platform_6of7.zip

Deinstall p10404530_112030_platform_7of7.zip

Tuesday, November 8, 2011

ASM

v$asm_diskgroup
v$asm_disk


create tablespace tbsname datafile size 10m autoextend on maxsize 10g;

alter tablespace tbsname add datafile size 10m autoectend on maxsize 10g;

View Description

V$ASM_ALIAS


In an ASM instance, contains one row for every alias present in every disk group mounted by the ASM instance.

In a DB instance, contains no rows.

V$ASM_ATTRIBUTE


Displays one row for each attribute defined. In addition to attributes specified by CREATE DISKGROUP and ALTER DISKGROUP statements, the view may show other attributes that are created automatically. Note that attributes are only displayed for disk groups where COMPATIBLE.ASM is set to 11.1 or higher.

V$ASM_CLIENT


In an ASM instance, identifies databases using disk groups managed by the ASM instance.

In a DB instance, contains information about the ASM instance if the database has any open ASM files.

V$ASM_DISK


In an ASM instance, contains one row for every disk discovered by the ASM instance, including disks that are not part of any disk group.

In a DB instance, contains rows only for disks in the disk groups in use by that DB instance.

This view performs disk discovery every time it is queried.

V$ASM_DISK_IOSTAT


Displays information about disk I/O statistics for each ASM client.

In a DB instance, only the rows for that instance are shown.

V$ASM_DISK_STAT


In an ASM instance, contains the same columns as V$ASM_DISK, but to reduce overhead, does not perform a discovery when it is queried. It does not return information about any disks that are new to the storage system. For the most accurate data, use V$ASM_DISK instead.

V$ASM_DISKGROUP


In an ASM instance, describes a disk group (number, name, size related info, state, and redundancy type).

In a DB instance, contains one row for every ASM disk group mounted by the local ASM instance.

This view performs disk discovery every time it is queried.

V$ASM_DISKGROUP_STAT


In an ASM instance, contains the same columns as V$ASM_DISKGROUP, but to reduce overhead, does not perform a discovery when it is queried. It does not return information about any disks that are new to the storage system. For the most accurate data, use V$ASM_DISKGROUP instead.

V$ASM_FILE


In an ASM instance, contains one row for every ASM file in every disk group mounted by the ASM instance.

In a DB instance, contains no rows.

V$ASM_OPERATION


In an ASM instance, contains one row for every active ASM long running operation executing in the ASM instance.

In a DB instance, contains no rows.

V$ASM_TEMPLATE


In an ASM or DB instance, contains one row for every template present in every disk group mounted by the ASM instance.

Friday, November 4, 2011

send email automatically in linux

1. mail
mail -s "test" test@test.com < messge.txt mail -s "test" test@test.com <test
>test
>test
>EOF

2. mutt
mutt -s "test" -a test.log test@test.com < message.txt mutt -s "test" -a test.log test@test.com <test
>test
>test
>EOF

ATTN: uuencode can be used with mail to attach file, but it was not installed by default. To install uuencode, install package: sharutils

reference:
http://www.cyberciti.biz/tips/sending-mail-with-attachment.html
http://www.thegeekstuff.com/2009/12/how-to-send-an-email-with-attachment-and-body-from-linux/

escape in sqlplus

set colsep ',' #used to generate csv file

set escape \ #used to escape substitution charactor in sql, not for sql processing.

for example select '\&1' from dual;

if you want to escape character in like clause

use .... like '\_sss' escape '\'

reference:
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:12520384680605

Thursday, November 3, 2011

date format in oracle loader

start_date TIMESTAMP "Mon dd yyyy hh:mi:ss:ff3AM",

select to_char(systimestamp,'Mon-dd-yyyy hh:mi:ss:ff3AM') from dual;

reference:
http://www.dbforums.com/oracle/1118058-sql-loader-date-format-unrecognized.html

date in unix

date +%Y_%m_%d

%% a literal %

%a localeâs abbreviated weekday name (e.g., Sun)

%A localeâs full weekday name (e.g., Sunday)

%b localeâs abbreviated month name (e.g., Jan)

%B localeâs full month name (e.g., January)

%c localeâs date and time (e.g., Thu Mar 3 23:05:25 2005)

%C century; like %Y, except omit last two digits (e.g., 21)

%d day of month (e.g, 01)

%D date; same as %m/%d/%y

%e day of month, space padded; same as %_d

%F full date; same as %Y-%m-%d

%g last two digits of year of ISO week number (see %G)

%G year of ISO week number (see %V); normally useful only with %V

%h same as %b

%H hour (00..23)

%I hour (01..12)

%j day of year (001..366)

%k hour ( 0..23)

%l hour ( 1..12)

%m month (01..12)

%M minute (00..59)

%n a newline

%N nanoseconds (000000000..999999999)

%p localeâs equivalent of either AM or PM; blank if not known

%P like %p, but lower case

%r localeâs 12-hour clock time (e.g., 11:11:04 PM)

%R 24-hour hour and minute; same as %H:%M

%s seconds since 1970-01-01 00:00:00 UTC

%S second (00..60)

%t a tab

%T time; same as %H:%M:%S

%u day of week (1..7); 1 is Monday

%U week number of year, with Sunday as first day of week (00..53)

%V ISO week number, with Monday as first day of week (01..53)

%w day of week (0..6); 0 is Sunday

%W week number of year, with Monday as first day of week (00..53)

%x localeâs date representation (e.g., 12/31/99)

%X localeâs time representation (e.g., 23:13:48)

%y last two digits of year (00..99)

%Y year

%z +hhmm numeric timezone (e.g., -0400)

%:z +hh:mm numeric timezone (e.g., -04:00)

%::z +hh:mm:ss numeric time zone (e.g., -04:00:00)

%:::z numeric time zone with : to necessary precision (e.g., -04,
+05:30)

%Z alphabetic time zone abbreviation (e.g., EDT)

Tuesday, November 1, 2011

Informatica

1. startup
$INFA_HOME/tomcat/bin/infaservice.sh startup

2. shutdown
$INFA_HOME/tomcat/bin/infaservice.sh shutdwon

log file: $INFA_HOME/tomcat/logs/catalina.out


3. change database connection info

$INFA_HOME/server/infasetup.sh updateGatewayNode -da database_hostname:database_port -ds database_name

4. change database password
$INFA_HOME/server/infasetup.sh UpdateGatewayNode -databasepassword

./infasetup.sh UpdateGatewayNode -da [new database host]:[new database port] -du [new database user] -dp [new database password -dt [database type i.e. db2] -ds [new database name]


reference:
https://forums.oracle.com/forums/thread.jspa?threadID=2240006
https://community.informatica.com/thread/27876
http://www.tek-tips.com/viewthread.cfm?qid=1561513

vncserver

1. start a vncserver session
vncserver
2. kill a vncserver session
vncserver -kill :1 (display number)