Kill user session in Oracle

If you need to kill all the sessions for a particular user you can try using the following script. It looks for all connections by AUSER (line 6) and then kills them. SET SERVEROUTPUT ON SIZE 1000000 BEGIN FOR usersession IN (SELECT s.USERNAME, s.OSUSER, s.STATUS, s.SID, s.SERIAL# FROM v$process p,v$session s WHERE p.addr = s.paddr AND s.username = 'AUSER') LOOP BEGIN IF usersession.STATUS = 'ACTIVE' THEN EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ' || '''' || usersession.sid || ',' || usersession.serial# || '''' || 'IMMEDIATE'; ELSIF usersession.STATUS = 'INACTIVE' THEN EXECUTE IMMEDI
Tags:

Creating a user and set password mysql

I've had a few problems creating users, assigning passwords and granting access to uses in MySQL. Below is one method I've found that works, at least for WordPress databases. mysql> create database wordpressdb; mysql> create user 'wordpressuser'@'localhost'; mysql> set password for 'wordpressuser'@'localhost'=PASSWORD('password'); mysql> use wordpressdb; mysql> grant all on * to 'wordpressuser'@'localhost';
Tags:

10 Useful VI commands

Here are a few VI commands that I use allot and find very useful. Once in command mode (by pressing ESC) enter: :wq To Save or Write and document and quit VI :w To save the document :q! To quite the document WITHOUT saving. J Capital J will join next line down on to the end of your current line. G Capital Go will take you to the end of document. CTRL+G Control G displays the current line number :n Enter a colon then a number to go to that line number :mn
Tags:

Changing the behaviour of the power button is Vista

By default in Windows Vista the "Power Button" on the start menu is set to hibernate. If you want to change it to power off instead, you need to do this:
  • Click Start then Control Panel
  • Click Additional Options
  • Click on System and Maintenance on the left
  • Click on Power Options
  • Click on Change plan settings for the currently select power plan
  • Click on Change advanced power settings
  • Expand the Power buttons and lid branch
  • Expand Start menu power button
  • Change the Setting as required
  • Click OK
Tags:

Using case and foreach in CSH

Here is a simple example of how to use a case and foreach statement in the C shell. #!/usr/bin/csh foreach SERVER (`cat hosts.list`) switch ($SERVER) case "server1": case "server2": echo "NOT shutting down " $SERVER breaksw default: echo Shutting down $SERVER... /usr/bin/ssh $SERVER init 5 endsw end This script will shutdown all servers listed in the file hosts.list, except server1 and server2
Tags:

Configuring the BASH shell

You first need to edit/create a .bash_profile file in your home directory. Note the . at the start of the filename. Put the following code into the file. # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi BASH_ENV=$HOME/.bashrc You also need to create a .bashrc file. Again in your home folder and again, note the . at the start. Put the following code into the .bashrc file. HOSTNAME=`hostname`; PS1='${LOGNAME}@${HOSTNAME}:${PWD}>' EDITOR=vi
Tags:

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer