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