Sponsored Content
Top Forums UNIX for Advanced & Expert Users Run only 3 sqlplus session at a time Post 303010851 by Yoda on Monday 8th of January 2018 01:12:51 PM
Old 01-08-2018
That for loop is basically wrong: Useless Use of Backticks

The right way is to use a while loop.

Here is another approach using pgrep to count the number of child sqlplus
Code:
#!/bin/ksh

while read name
do
        sqlplus -s usert/password@host <<EOF &
        set linesize 1000
        SELECT '$name', To_char(CURRENT_TIMESTAMP(0),'DD-Mon-YYYY HH24:MI:SS') AS start_time FROM dual;
        EXEC PROC ('$name');
        SELECT '$name', To_char(CURRENT_TIMESTAMP(0),'DD-Mon-YYYY HH24:MI:SS') AS end_time FROM dual;
        exit
EOF
        [ "$( pgrep -P $$ -l sqlplus | wc -l )" -eq 3 ] && wait

done < abc.txt


Last edited by Yoda; 01-08-2018 at 03:14 PM.. Reason: input redirection fix, thanks to RudiC for pointing that out.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

setting session time

Please lemme know how & where to set the session time for ftp connection in Wu-ftp . Regards Gambhi. (5 Replies)
Discussion started by: gambhi_s
5 Replies

2. UNIX for Dummies Questions & Answers

Session time out

Hi, We have a generic login id :- ship1 . There can be any number of sessions for this login ID. I'm working on a way to log off idle sessions ( not logins) . I searched the forum and found TMOUT. Is it at login level or session level ? ( looks like it is at login level) But I added it to... (2 Replies)
Discussion started by: newtoxinu
2 Replies

3. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies

4. Shell Programming and Scripting

Is it possible..when ftp session disconnect and it can automatic run again?

Hi, Is is possible when ftp script disconnect by remote server and it can restart to tranfer (such as restart in 10 mins, etc)? Please help!!!! (1 Reply)
Discussion started by: happyv
1 Replies

5. UNIX for Dummies Questions & Answers

how to run who am i from remote session

I just moved from AIX 4 to AIX 5.3. the command `who am i` is essential to our logon scripts; but it does not work anymore, it says the process is not attached to a terminal. Is it possible to run this command remotely? It works for remote root sessions. If it is not is there another way to... (2 Replies)
Discussion started by: raidzero
2 Replies

6. UNIX for Advanced & Expert Users

Xserver connect and run CDE session from Windows PC

Hope someone can help. I have 5 Unix Tru64 ver 4.0/5.1B, boxes and I'm trying to connect and run CDE session from my PC. I have tried using Reflections, and Xming with no luck. Can someone tell me what exactly needs to be running on the Tru64 boxes in order for this to work. Along with what or how... (4 Replies)
Discussion started by: Troberts50
4 Replies

7. Shell Programming and Scripting

how to run a command as soon as user exits from session

I need to write a script, where I have to get names of files that are to be deleted from a user and have to delete those files when he exits session. How to set a particular command to be run as soon as user exits from a session? Can somebody help? I have to write a script on linux system.... (3 Replies)
Discussion started by: yashashri
3 Replies

8. Shell Programming and Scripting

How to run scripts within a telnet session?

I want to connect to a remote host using telnet there is no username/password verification just telnet remotehost then I need to input some commands for initialization and then I need to repeat the following commands: cmd argument argument is read from a local file, in this... (1 Reply)
Discussion started by: esolve
1 Replies

9. Shell Programming and Scripting

Need to track what Commands run in a login session

Hi I need to track what commands run in login session in solaris whether it is root or any normal users in bash shell. My actual requirement is that when a user (nomal/root) login into the system, whatever commands he run, it should log into file on specified path . I don't require command... (4 Replies)
Discussion started by: hb00
4 Replies
SESSION_DESTROY(3)							 1							SESSION_DESTROY(3)

session_destroy - Destroys all data registered to a session

SYNOPSIS
bool session_destroy (void ) DESCRIPTION
session_destroy(3) destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start(3) has to be called. In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie(3) may be used for that. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Destroying a session with $_SESSION <?php // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Finally, destroy the session. session_destroy(); ?> NOTES
Note Only use session_unset(3) for older deprecated code that does not use $_SESSION. SEE ALSO
unset(3), setcookie(3). PHP Documentation Group SESSION_DESTROY(3)
All times are GMT -4. The time now is 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy