Tuesday 18 December 2012

Oracle Cluster ware

-- Stops Cluster resource # crsctl stop cluster -- Removed from cluster # crsctl stop crs -- Add cluster & starts cluster resource # crsctl start crs

Wednesday 17 October 2012

Install gui to server

yum groupinstall "GNOME Desktop Environment" Works on Redhat, CentOS, Fedora

Oracle Enterprise Manager (EM)

Create EM at a later time
emca -config dbcontrol db -repos create -silent -ORACLE_HOSTNAME devdb1.com -PORT 1521 -SERVICE_NAME PRDB1.devdb1 -SYS_PWD pa55w0rd -SID PRDB1 -DBSNMP_PWD pa55w0rd -SYSMAN_PWD pa55w0rd -DBCONTROL_HTTP_PORT 1158 -AGENT_PORT 3938 -RMI_PORT 5521 -JMS_PORT 5541

Drop EM at a later time
emca -deconfig dbcontrol db -repos drop -silent -ORACLE_HOSTNAME devdb1.com -PORT 1521 -SERVICE_NAME PRDB1.devdb1 -SYS_PWD pa55w0rd -SID PRDB1 -DBSNMP_PWD pa55w0rd -SYSMAN_PWD pa55w0rd -DBCONTROL_HTTP_PORT 1158 -AGENT_PORT 3938 -RMI_PORT 5521 -JMS_PORT 5541

When the database host name or the IP address changes, deconfigure and then reconfigure the Database Console with the repository create command. Run the following command:
emca -deconfig dbcontrol db -repos drop emca -config dbcontrol db -repos create

On 17 Oct 2012, i had issues / errors createing the above, so finally found, I had to apply the patch since for db 10.2.0.5 certificate was out of date:

PATCH:8350262 - CREATE DBCONSOLE CERT WITH 10YEAR VALIDITY

Good read/doc on this topic in Metalink: Enterprise Manager Database Control Configuration - Recovering From Errors Due to CA Expiry on Oracle Database 10.2.0.4 or 10.2.0.5 [ID 1222603.1]

Tuesday 2 October 2012

SQLPlus formating -without any fancy clients

Sqlplus output are a pain for end users (if too many columns), Here is a middle middle ground, without too much work and without a client, giving output with html tags. Here is quick step on formatting with html, I think we should offer, since little work for us, and gives some formatting.
  1. Save the below sql as html.sql (taken from http://uhesse.com)
  2. Run the users sql, it will output on screen
  3. Run @html
  4. HTML out put will go in myoutput.html
==
----------------------------------------
-- get the last SQL*Plus output in HTML
-- after Tanel Poder
----------------------------------------

set termout off

set markup HTML ON HEAD " -
 -
" -
BODY "" -
TABLE "border='1' align='center' summary='Script output'" -
SPOOL ON ENTMAP ON PREFORMAT OFF

spool myoutput.html

l
/

spool off
set markup html off spool off
host firefox myoutput.html
set termout on

Tuesday 25 September 2012

next page

http://openelec.thestateofme.com/

Monday 24 September 2012

Raspberry Pi

1. Pre Pi OS prep (install tool) I installed this 1st 'win32diskimager-binary.zip' 2. Install OS on Pi SD-Card Using the tool of step 1, copy the OS image to SD Card 3. Test OS Boot the machine worked fine. There is no ON button, connecting the power is ON 4. Java on Pi Installed Java, after having to regiser to download I have used: 'Java SE Embedded 6 - ARMv6/7 Linux - Headless' gunzip tar xvf The directory ejre1.6.0_34 will be created in your current directory and populated with the entire JRE release. This installation directory, /ejre1.6.0_34, will be hereafter referred to as . Add /bin to your PATH environment variable setting in order to run the Java binaries. This also worked for me on 23 Sep 2012 5. Testing of Sound To test sound, ref: http://raspberrypi.stackexchange.com/questions/44/why-is-my-audio-sound-output-not-working sudo apt-get install alsa-utils sudo modprobe snd_bcm2835 sudo aplay /usr/share/sounds/alsa/Front_Center.wav On 24 Sep 2012, this worked for my on my R.Pi

Saturday 8 September 2012

Excel notes for phone style

=IF(MID(AN54,1,2)="79",CONCATENATE("0",MID(AN54,1,2),"-",MID(AN54,3,3),"-",MID(AN54,6,10)),AN54)

Thursday 23 August 2012

Grant Materialized view

grant query rewrite to user1; grant create materialized view to user1; Make sure: SYSTEM> show parameter query NAME TYPE VALUE ------------------------------ ----------- ------------------ query_rewrite_enabled string TRUE

Thursday 12 July 2012

Zen cart About Page goes to Page not found

Zen Cart (Zencart / Zen-Cart) About Page goes to Page not found
After much searching.
Copied the whole folder from hosting site to local disk and done a diff and found following folder (location)/includes/modules/pages/about_us/ was missing on hosting.

Tuesday 5 June 2012

USB bootable OS

How to create and use Live USB https://fedorahosted.org/liveusb-creator/ Took very long to fine the CenOS 5 live cd: http://vault.centos.org/5.5/isos/x86_64/ For Linux, do: yum install liveusb-creator Other option, worked for Alex: http://unetbootin.sourceforge.net/ http://unetbootin.sourceforge.net/unetbootin-windows-latest.exe

Tuesday 22 May 2012

ASM tips

ASM Clients and status -- Clients select INSTANCE_NAME, DB_NAME, STATUS from v$asm_client order by DB_NAME,INSTANCE_NAME;

ASM Diskgroups & Space, diskgroup size col pct_used for a9 set line 200 select name, group_number,state, round((total_mb-free_mb)/total_mb*100)||'%' pct_used, total_mb/1024 total_gb,round(free_mb/1024) free_gb from V$ASM_DISKGROUP;

ASM Archivelog Usage by DB col path for a40 set line 200 SELECT substr(full_path,1,instr(full_path,'/',1,2)) path, round(sum(f.bytes)/1024/1024) sum_MB, count(*) qty FROM (SELECT CONCAT('+'||gname, SYS_CONNECT_BY_PATH(aname,'/')) full_path, group_number, file_number FROM (SELECT g.name gname, a.parent_index pindex, a.name aname, a.reference_index rindex, a.group_number, a.file_number FROM v$asm_alias a, v$asm_diskgroup g WHERE a.group_number = g.group_number) START WITH (MOD(pindex, POWER(2, 24))) = 0 CONNECT BY PRIOR rindex = pindex) sub, v$asm_file f WHERE sub.group_number = f.group_number AND sub.file_number = f.file_number AND f.type = 'ARCHIVELOG' GROUP BY substr(full_path,1,instr(full_path,'/',1,2)) ORDER BY 2; Disk Usage by file/object name select substr(al.name, 0, instr(al.name, '.')-1) Friendly_name, round(sum(a.bytes)/1024/1024, 2) from v$asm_file a, v$asm_alias al where al.file_number = a.file_number and a.group_number = 2 group by substr(al.name, 0, instr(al.name, '.')-1); If a db has a restore point and you want to turn off flash back, it was slightly tricky on 10g. After few tries found that i had to drop the restore point first. select flashback_on from v$database; select name, scn, time, guarantee_flashback_database from v$restore_point; DROP RESTORE POINT FRI_1120_TEST_RW; alter database flashback off; Drop files. $ ORACLE_SID=+ASM; export ORACLE_SID $ sqlplus "/ as sysdba" SQL> ALTER DISKGROUP TESTDB_DATA2 DROP FILE '+TESTDB_DATA2/testdb/datafile/app_data.256.598127837';

Thursday 10 May 2012

snapshot and fast start db

Very simple to change the standby to snapshop (allows you wirt)

Wednesday 9 May 2012

Oracle Active Data Guard

Oracle Active Data Guard SE1: N SE: N EE: Y - Extra cost option

Tuesday 8 May 2012

Data Guard using RMAN

Data Guard using RMAN run { allocate channel prmy1 type disk; allocate channel prmy2 type disk; allocate channel prmy3 type disk; allocate channel prmy4 type disk; allocate auxiliary channel stby type disk; duplicate target database for standby from active database spfile parameter_value_convert 'nidb1_uk','nidb1_fr' set db_unique_name='nidb1_fr' set db_create_file_dest='+SBDAT' set db_recovery_file_dest='+SBFRA' set db_recovery_file_dest_size='5G' set control_files='+SBDAT' set log_archive_max_processes='5' set fal_client='nidb1_fr' set fal_server='nidb1_uk' set standby_file_management='AUTO' set log_archive_config='dg_config=(nidb1_uk,nidb1_fr)' set log_archive_dest_2='service=nidb1_uk ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=nidb1_uk' ; }

Thursday 29 March 2012

My Notes

My notes.

Quran Sura Yasin

Quran Sura Yasin, sura 36

Search or sort Apache logs

Search or sort Apache logs

Script to count unique ips in apache access log


cat my-web-app-access_log.4 | grep "04/Mar/2012:10:" >> day_04.txt

awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }' myfile.txt | sort -nr | more

awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }' myfile.txt

Wednesday 29 February 2012

Flashback

At last we have the lience to use Flashback:

Good site.
http://www.oracle-developer.net/display.php?id=313


SQL> FLASHBACK TABLE t TO BEFORE DROP;

Tuesday 24 January 2012

Php time out sample code



session_start();

// In seconds, so 900 is 15min
$inactive = 900;

if(isset($_SESSION['start']) ) {

$session_life = time() - $_SESSION['start'];

if($session_life > $inactive){

header("Location: user_logout.php");

}

}

$_SESSION['start'] = time();

Friday 20 January 2012

MySql admin Create user / root privs

MySql admin commands

Option 1 - New user, Dedicated commands
========

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'pass1';

GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'user1'@'localhost';



Option 2 - New user, Direct sql
========

INSERT INTO user (Host,User,Password,Select_priv,Insert_priv)
VALUES('%','user4',PASSWORD('pass3'),'Y','Y');



Root privs

GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%'
GRANT ALL PRIVILEGES ON *.* TO 'user1'@'localhost'
FLUSH PRIVILEGES;



Ref: http://www.databasef1.com/tutorial/mysql-create-user.html