If you kill ALL sessions, you kill Oracle internal processes. So isn't it better to shutdown the instance? If you mean only user sessions, you may loop through v$session where username is not null. You must also kill your own session after killing all others. To find your session select from v$session where audsid=userenv('sessionid').