Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Generate a Sequence like in Oracle Post 302177200 by jim mcnamara on Thursday 20th of March 2008 09:43:00 AM
Old 03-20-2008
You have to have persistent storage - a file, a database table, etc. Oracle sequences are stored along with other metadata like the schema on disk.

Try using a file. But. If this is for multiple processes with simultaneous access, then you have to use some sort of resource locking mechanism - a file lock might be an option. See either man flock or maybe man ioctl
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generate report in HTML file from Oracle DB

Hi Team, I need a suggestion/comments for my below requirement. I have a procedure which performs some DDL operations & loads data into a Oracle table. This status contains Audit data. What i wanted to do is, once the procedure is completed (daily), shell script should retrive the data from the... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies

2. Shell Programming and Scripting

generate a sequence

how can i generate following sequence for a given input 1,2,3,4,5 1->2 2->3 3->4 4->5 1->2,3 1,2->3 2->3,4 2,3->4 3->4,5 3,4->5 1->2,3,4 1,2->3,4 1,2,3->4 (4 Replies)
Discussion started by: vaibhavkorde
4 Replies

3. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

4. Shell Programming and Scripting

Script to generate sequence of numbers

I need awk script to generate part number sequencing based on data in multiple columns like below Input File --------- Col A|Col B|Col C| 1|a|x| 2|b|y| |c|z| | |m| | |n| And out put should be like 1ax 1ay 1az 1am 1an 1bx 1by (6 Replies)
Discussion started by: aramacha
6 Replies

5. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies

6. BSD

Mcookie, pkg -l to generate random sequence

I am setting this thread to this bsd forum, though it may fit into bash. But as using bsd and the terminal, I would like to generate a random sequence of alphanumerical digits, such as I use to do so on linux by typing just mcookiethis one gives me a pretty random password, but it does not on bsd... (0 Replies)
Discussion started by: 1in10
0 Replies

7. Shell Programming and Scripting

Parameterizing to dynamically generate the extract file from Oracle table using Shell Script

I have below 2 requirements for parameterize the generate the extract file from Oracle table using Shell Script. Could you please help me by modifying the script and show me how to execute it. First Requirement: I have a requirement where I need to parameterize to generate one... (0 Replies)
Discussion started by: hareshvikram
0 Replies
flock(3UCB)					     SunOS/BSD Compatibility Library Functions					       flock(3UCB)

NAME
flock - apply or remove an advisory lock on an open file SYNOPSIS
/usr/ucb/cc[ flag ... ] file ... #include <sys/file.h> int flock( fd, operation); int fd, operation; DESCRIPTION
flock() applies or removes an advisory lock on the file associated with the file descriptor fd. The compatibility version of flock() has been implemented on top of fcntl(2) locking. It does not provide complete binary compatibility. Advisory locks allow cooperating processes to perform consistent operations on files, but do not guarantee exclusive access (that is, pro- cesses may still access files without using advisory locks, possibly resulting in inconsistencies). The locking mechanism allows two types of locks: shared locks and exclusive locks. More than one process may hold a shared lock for a file at any given time, but multiple exclusive, or both shared and exclusive, locks may not exist simultaneously on a file. A lock is applied by specifying an operation parameter LOCK_SH for a shared lock or LOCK_EX for an exclusive lock. The operation paramerer may be ORed with LOCK_NB to make the operation non-blocking. To unlock an existing lock, the operation should be LOCK_UN. Read permission is required on a file to obtain a shared lock, and write permission is required to obtain an exclusive lock. Locking a seg- ment that is already locked by the calling process causes the old lock type to be removed and the new lock type to take effect. Requesting a lock on an object that is already locked normally causes the caller to block until the lock may be acquired. If LOCK_NB is included in operation, then this will not happen; instead, the call will fail and the error EWOULDBLOCK will be returned. RETURN VALUES
flock() returns: 0 on success. -1 on failure and sets errno to indicate the error. ERRORS
EBADF The argument fd is an invalid descriptor. EINVAL operation is not a valid argument. EOPNOTSUPP The argument fd refers to an object other than a file. EWOULDBLOCK The file is locked and the LOCK_NB option was specified. SEE ALSO
lockd(1M), chmod(2), close(2), dup(2), exec(2), fcntl(2), fork(2), open(2), lockf(3C) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applications is unsupported. Locks are on files, not file descriptors. That is, file descriptors duplicated through dup(2) or fork(2) do not result in multiple instances of a lock, but rather multiple references to a single lock. If a process holding a lock on a file forks and the child explicitly unlocks the file, the parent will lose its lock. Locks are not inherited by a child process. Processes blocked awaiting a lock may be awakened by signals. Mandatory locking may occur, depending on the mode bits of the file. See chmod(2). Locks obtained through the flock() mechanism under SunOS 4.1 were known only within the system on which they were placed. This is no longer true. SunOS 5.10 19 Jul 1994 flock(3UCB)
All times are GMT -4. The time now is 05:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy