Operating System - HP-UX
1748267 Members
3846 Online
108760 Solutions
New Discussion юеВ

Re: How to force oracle to hang

 
SOLVED
Go to solution

How to force oracle to hang

Hi,

I'm testing some MC/ServiceGuard monitoring scripts, and I'm looking for a reliable way to make Oracle 'hang' (as opposed to 'crash').

I have a script that connects to oracle, and updates a row in a table with the current date. The script is timed, and if it doesn't respond after X seconds then the monitor can cause a failover/restart of oracle. Now I want to test this out, but to do this I need to force oracle to 'hang'.

My first thought was that

alter system archive log stop;

followed by

alter system switch logfile;

several times until all redo log groups were used would work. This has indeed hung the session that issued the switch logfile command, but my monitor script is still happily chugging away updating the database every few seconds... I'm guessing that its still using the last redo log, and the whole database won't hang completely until this log is 'full' (which with the tiny updates I'm doing, and the size of the redo logs could take a while).

Does anyone know a quicker/easier way of making the database 'hang' in this realistic manner ( I know I could send SIGSTOP to all the server processes, but thats not really a 'realistic' test)

10 points for the perfect answer.

Cheers

Duncan

I am an HPE Employee
Accept or Kudo
16 REPLIES 16
Michael Steele_2
Honored Contributor

Re: How to force oracle to hang

Kill the lmon daemon.

The Advanced SG class taught by HP has an OPS lab which tests for oracle failovers. I can provide you with what I have since it uses the oracle1.sh monitoring script.

Verify cluster and both instances are running:

SVRMGR>connect internal
SVRMGR>select * from s$active_instanaces
SVRMGR>shutdown
SVRMGR>exit
$exit
#vgchange -a n vg_ops (* vg defined in oracle_package_cntl. *)

Add the packages and check that they continue running:

# cmrunpkg -n node1 ora_pkg
# cmviewcl
etc.

Test reformation:

Power off node1. Repeat for node2.

Test reformation after internal failure:

TOC on node1. Repeat node2.

Check instances:

kill lmon on node1. Repeat node2.

Check instances:

Run 'ins_rows_1' on node1 and kill lmon. Repeat node 2.

NOTE: This last test will be a little different for non OPS servers.
Support Fatherhood - Stop Family Law

Re: How to force oracle to hang

yeah, I know that will hang an OPS/RAC database, but single node Oracle databases don't have an lmon process, so that isn't going to work...

thanks,

Duncan

I am an HPE Employee
Accept or Kudo
John Bolene
Honored Contributor

Re: How to force oracle to hang

If you have hot pluggable disk drives, unplug one that has the database on it.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Michael Steele_2
Honored Contributor

Re: How to force oracle to hang

kill pmon.
Support Fatherhood - Stop Family Law

Re: How to force oracle to hang

Good point John, but I'd expect my EMS HA Monitors to pick that up before my oracle monitor does... I'm really looking to test a software hang of the database rather than a hang caused by failing hardware... and besides on my test kit I'm using internal disks!

Thanks

Duncan

I am an HPE Employee
Accept or Kudo
Christian Gebhardt
Honored Contributor
Solution

Re: How to force oracle to hang

Hi

to fill the redologs the best way is to inesrt and delete data.

create table redofill_test (col1 char(2000)) tablespace ;

begin
for i in 1 .. 10000
loop
insert into redofill_test values ('a');
commit;
delete from redofill_test;
commit;
end loop;
end;
/

drop table redofill_test;


char is a good choice for the datatype because oracle allocates 2000 bytes for each row.

Chris

Re: How to force oracle to hang

Killing pmon doesn't cause a hang, it causes the database to crash.

And I get this from my insert script:

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist

So not a hang, but a crash.

Keep em coming!

Duncan

I am an HPE Employee
Accept or Kudo
Dietmar Konermann
Honored Contributor

Re: How to force oracle to hang

Maybe you should only suspend the pmon? Afterwards you could resume it again.

# kill -STOP
...
# kill -CONT

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)

Re: How to force oracle to hang

Chris, Dietmar,

I'll give these a try...


Thanks

Duncan

I am an HPE Employee
Accept or Kudo