select owner
, object_name
, object_type
from ALL_OBJECTS
where object_name = 'COST_CENTRE';
Tuesday, April 29, 2014
Friday, April 25, 2014
ImageMagick: Verify installation
# /usr/local/bin/display
/usr/local/bin/display: error while loading shared libraries: libMagickCore-6.Q16.so.2: cannot open shared object file:
# ldconfig /usr/local/lib
then run
# /usr/local/bin/display
/usr/local/bin/display: error while loading shared libraries: libMagickCore-6.Q16.so.2: cannot open shared object file:
# ldconfig /usr/local/lib
then run
# /usr/local/bin/display
Tuesday, April 22, 2014
IBM HTTPServer: HTTPS doesn't work after renew certificate
After renew HTTPServer certificate, http works, but https doesnot:
Check if SSLServerCert is defined in httpd.conf, if yes, you can point it to new certificate name.
SSLServerCert <new certificate name>
Check if SSLServerCert is defined in httpd.conf, if yes, you can point it to new certificate name.
SSLServerCert <new certificate name>
Wednesday, April 16, 2014
Oracle: Create New User
Create Oracle schema goweekend
1. First verify name conflicts
SQL> select * from dba_users where username = 'GOWEEKEND';
SQL> CREATE USER GOWEEKEND IDENTIFIED BY think4ME DEFAULT TABLESPACE USERSPACE TEMPORARY TABLESPACE temp;
GRANT CREATE TABLE TO GOWEEKEND;
GRANT CREATE PROCEDURE TO GOWEEKEND;
GRANT CREATE SESSION TO GOWEEKEND;
GRANT CREATE VIEW TO GOWEEKEND;
GRANT RESOURCE TO GOWEEKEND;
select * from dba_role_privs where grantee = 'GOWEEKEND';
select * from dba_tab_privs where grantee = 'GOWEEKEND';
select * from dba_sys_privs where grantee = 'GOWEEKEND';
1. First verify name conflicts
SQL> select * from dba_users where username = 'GOWEEKEND';
SQL> CREATE USER GOWEEKEND IDENTIFIED BY think4ME DEFAULT TABLESPACE USERSPACE TEMPORARY TABLESPACE temp;
GRANT CREATE TABLE TO GOWEEKEND;
GRANT CREATE PROCEDURE TO GOWEEKEND;
GRANT CREATE SESSION TO GOWEEKEND;
GRANT CREATE VIEW TO GOWEEKEND;
GRANT RESOURCE TO GOWEEKEND;
select * from dba_role_privs where grantee = 'GOWEEKEND';
select * from dba_tab_privs where grantee = 'GOWEEKEND';
select * from dba_sys_privs where grantee = 'GOWEEKEND';
Tuesday, April 15, 2014
Upgrade perl from CPAN console
Run command cpan, and answer the questions, if you don't know, just keep default.
To reconfigure cpan:
# cpan
cpan[]> o conf init
Report updates for all modules.
# cpan
cpan[1]> r
# cpan
cpan[1]> upgrade
End of configuration questions.
Stripping down executable paths...
Creating config.sh...
Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
Propagating recommended variable $libdb_needs_pthread...
If you'd like to make any changes to the config.sh file before I begin
to configure things, do it as a shell escape now (e.g. !vi config.sh).
Press return or use a shell escape to edit config.sh:
Open another terminal window.
# cd ~/.cpan/build/perl-5.18.2-*
# vi config.sh
: Configure command line arguments.
config_arg0='./Configure'
config_args='-Dnoextensions=ODBM_File'
config_argc=1
config_arg1='-Dnoextensions=ODBM_File'
Problem
ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’:
ODBM_File.xs:124: error: too few arguments to function ‘dbmclose’
make[1]: *** [ODBM_File.o] Error 1
Workaround
Post upgrade
Can't call method "http" on unblessed reference at /usr/local/lib/perl5/5.18.2/CPAN/FirstTime.pm line 1868.
Solution:
cacti:~ #cpan
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters. Configuration will be written to
<</root/.cpan/CPAN/MyConfig.pm>>
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes]
Autoconfigured everything but 'urllist'.
Now you need to choose your CPAN mirror sites. You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.
Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] no
Would you like to pick from the CPAN mirror list? [yes]
Found a cached mirror list as of Mon Apr 14 07:11:02 2014
If you'd like to just use the cached copy, answer 'yes', below.
If you'd like an updated copy of the mirror list, answer 'no' and
I'll get a fresh one from the Internet.
Shall I use the cached mirror list? [yes] no
Trying to refresh your mirror list
Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY
Error downloading with HTTP::Tiny: Not a CODE reference at /usr/local/lib/perl5/5.18.2/CPAN/HTTP/Client.pm line 112, <STDIN> line 4.
Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY.gz
Error downloading with HTTP::Tiny: Not a CODE reference at /usr/local/lib/perl5/5.18.2/CPAN/HTTP/Client.pm line 112, <STDIN> line 4.
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Could not connect to host 'ftp.perl.org' with Net::FTP
Fetching with Net::FTP
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz
Could not connect to host 'ftp.perl.org' with Net::FTP
Proxy authentication needed!
(Note: to permanently configure username and password run
o conf proxy_user your_username
o conf proxy_pass your_password
)
Username:
Warning: Term::ReadKey seems not to be available, your password will be echoed to the terminal!
Password:
Trying with
/usr/bin/wget -O "/root/.cpan/sources/MIRRORED.BY.tmp14002"
to get
http://www.perl.org/CPAN/MIRRORED.BY
--2014-04-16 13:06:23-- http://www.perl.org/CPAN/MIRRORED.BY
Resolving proxy.goweekend.ca... 137.15.210.13
Connecting to proxy.goweekend.ca|137.15.210.13|:8888... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2014-04-16 13:06:23 ERROR 407: Proxy Authentication Required.
Function system("/usr/bin/wget -O "/root/.cpan/sources/MIRRORED.BY.tmp14002" "http://www.perl.org/CPAN/MIRRORED.BY" ")
returned status 1 (wstat 256), left
/root/.cpan/sources/MIRRORED.BY.tmp14002 with size 0
Trying with
/usr/bin/wget -O "/root/.cpan/sources/MIRRORED.BY.tmp14002"
to get
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
--2014-04-16 13:06:23-- ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
connected.
Proxy request sent, awaiting response... 200 OK
Length: 129952 (127K) [octet/stream]
Saving to: `/root/.cpan/sources/MIRRORED.BY.tmp14002'
100%[=================================================================================================================================>] 129,952 364K/s in 0.3s
2014-04-16 13:06:24 (364 KB/s) - `/root/.cpan/sources/MIRRORED.BY.tmp14002' saved [129952/129952]
First, pick a nearby continent and country by typing in the number(s)
in front of the item(s) you want to select. You can pick several of
each, separated by spaces. Then, you will be presented with a list of
URLs of CPAN mirrors in the countries you selected, along with
previously selected URLs. Select some of those URLs, or just keep the
old list. Finally, you will be prompted for any extra URLs -- file:,
ftp:, or http: -- that host a CPAN mirror.
You should select more than one (just in case the first isn't available).
(1) Africa
(2) Asia
(3) Europe
(4) North America
(5) Oceania
(6) South America
Select your continent (or several nearby continents) [] 4
(1) Canada
(2) Costa Rica
(3) Mexico
(4) United States
Select your country (or several nearby countries) [] 1
(1) ftp://CPAN.mirror.rafal.ca/pub/CPAN/
(2) ftp://cpan.sunsite.ualberta.ca/pub/CPAN/
(3) ftp://ftp.nrc.ca/pub/CPAN/
(4) ftp://mirror.arcticnetwork.ca/pub/CPAN/
(5) ftp://mirror.csclub.uwaterloo.ca/CPAN/
(6) ftp://mirror.its.dal.ca/cpan/
(7) ftp://mirror.vexxhost.com/cpan/
(8) http://CPAN.mirror.rafal.ca/
(9) http://cpan.arcticnetwork.ca/
(10) http://cpan.mirror.vexxhost.com/
(11) http://cpan.perlnow.com/
(12) http://cpan.sunsite.ualberta.ca/
(13) http://httpupdate25.cpanel.net/CPAN/
(14) http://mirror.csclub.uwaterloo.ca/CPAN/
(15) http://mirror.its.dal.ca/cpan/
(16) http://mirrors.gossamer-threads.com/CPAN/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, hyphenated ranges allowed
e.g. '1 4 5' or '7 1-4 8' [] 5 14 15 1
Now you can enter your own CPAN URLs by hand. A local CPAN mirror can be
listed using a 'file:' URL like 'file:///path/to/cpan/'
Enter another URL or ENTER to quit: []
New urllist
ftp://mirror.csclub.uwaterloo.ca/CPAN/
http://mirror.csclub.uwaterloo.ca/CPAN/
http://mirror.its.dal.ca/cpan/
ftp://CPAN.mirror.rafal.ca/pub/CPAN/
Autoconfiguration complete.
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.
cpan[1]> exit
Terminal does not support GetHistory.
Lockfile removed.
cacti:~ # cpan
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.
cpan[1]>
Wednesday, April 9, 2014
Perl: Install Perl 5.18.2
Download source code from http://www.perl.org/get.html#unix_like
# ./Configure -des -Dprefix=/opt/perl-5.18.2 -Dnoextensions=ODBM_File
or you can add extra modules
# ./Configure -des -Dprefix=/opt/perl-5.18.2 -Dnoextensions=ODBM_File -Dextras="Bundle::LWP DBI AppConfig"
#export LD_LIBRARY_PATH=/opt/perl-5.18.0/lib/5.18.0:$LD_LIBRARY_PATH
# make test
# make install
# ./Configure -des -Dprefix=/opt/perl-5.18.2 -Dnoextensions=ODBM_File
or you can add extra modules
# ./Configure -des -Dprefix=/opt/perl-5.18.2 -Dnoextensions=ODBM_File -Dextras="Bundle::LWP DBI AppConfig"
#export LD_LIBRARY_PATH=/opt/perl-5.18.0/lib/5.18.0:$LD_LIBRARY_PATH
# make test
# make install
Monday, April 7, 2014
Cacti Monitor Solaris ZFS
Reference: http://forums.cacti.net/viewtopic.php?f=12&t=47979
Get Dataquery and import it into Cacti: http://files.hypervisor.fr/scripts/cacti_data_query_zfs_-_zpool_usage.xml
Get SNMP query: http://files.hypervisor.fr/scripts/zpool_usage.xml , and copy it to /usr/share/cacti/resource/snmp_queries
Extend SNMP on Solaris
append below entries to /etc/net-snmp/snmp/snmpd.conf
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"
Restart SNMP,
# svcadm disable svc:/application/management/net-snmp:default
# svcadm enable svc:/application/management/net-snmp:default
Get Dataquery and import it into Cacti: http://files.hypervisor.fr/scripts/cacti_data_query_zfs_-_zpool_usage.xml
Get SNMP query: http://files.hypervisor.fr/scripts/zpool_usage.xml , and copy it to /usr/share/cacti/resource/snmp_queries
Extend SNMP on Solaris
append below entries to /etc/net-snmp/snmp/snmpd.conf
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"
Restart SNMP,
# svcadm disable svc:/application/management/net-snmp:default
# svcadm enable svc:/application/management/net-snmp:default
Wednesday, April 2, 2014
Oracle aggregation: Listagg
SQL> SELECT deptno,
listagg (ename, ',') WITHIN GROUP (ORDER BY ename)
enames
FROM emp
GROUP BY deptno
/
DEPTNO ENAMES
---------- --------------------------------------------------
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
Output table into csv format
spool dba_users.csv
set heading off
set wrap off
SET MARKUP HTML PREFORMAT ON
set colsep ,
SET LINESIZE 900
select LTRIM(rtrim(USERNAME)),rtrim(ltrim(USER_ID)),rtrim(ACCOUNT_STATUS),trim(PROFILE)
from dba_users where ACCOUNT_STATUS like 'EXP%';
spool off
exit
Subscribe to:
Posts (Atom)