Wednesday, February 27, 2013

kill oracle sessions


select count(1),user from v$session group by user;
select 'alter system kill session '||''''||sid||','||serial#||''''||'immediate;' from v$session
select * from v$locked_object; ----- get the sid
select sid,serial# from v$session where sid=134; ------get serial#
alter system kill session '134,2386';

Increase the session in Oracle


processes=x
sessions=x*1.1+5
transactions=sessions*1.1

E.g.
alter system set processes=1000 scope=spfile;
alter system set sessions=1500 scope=spfile ;


processes=500
sessions=555
transactions=610


alter system set transactions=610 scope=both;

AWR report


run the script in sqlplus prompt and follow the instructions
@?/rdbms/admin/awrrpt.sql

Restore a single table from a whole db backup mysql


suppose we have dump.sql file for backup of whole database

fire following command
grep -n 'Table structure' dump.sql

suppose the table you want is shown with 40th line
and the table next to it is 62th line

extract the table using following command
sed -n '40,61 p' dump.sql > t2.sql

then restore table using mysql utility using t2.sql

rename database in sqlserver if database is running processes


use master;

Go

alter database M2wServices_tr_sh set single_user with rollback immediate;

GO

alter database M2wServices_tr_sh modify name = M2wServices_tr ;

GO

alter database M2wServices_tr set multi_user;

Go

set mysql password for root user if forget



service mysql stop
mysqld_safe --skip-grant-tables


open other putty login

mysql --user=root mysql
ocg#81@2012

use mysql
update user set Password=PASSWORD('mod#db#543') where user='root';
flush privileges;
exit;

create data base link in oracle




CREATE PUBLIC DATABASE LINK name_of_link
CONNECT TO oracle_username
IDENTIFIED BY password -- double quotes here
USING 'database_sid' -- single quotes here ;

eg.
CREATE PUBLIC DATABASE LINK talkies
CONNECT TO username talkies identified BY "talkies123"
USING 'vxmldb1';

/
-- test the dblink
select * from dual@name_of_link
/