I am writing a shell script for Archive Purge for the table having rows < 1 year. The shell script has to extract the rows from the table and write those extracted rows to a text file. Then from the text file, each rows will be read and deleted by means of delete query one by one. The fields will be defined by means of position.
For Eg. ZB_RCVBL_TRACKER consists of the fields as follows.
PCN, ACCNO, TRANCD, AMOUNT, LOB_TIMESTAMP
After the rows are extracted and written in to a text file. I need to get the fields PCN, ACCNO, TRANCD, LOB_TIMESTAMP from the text file and pass those values to the query
DELETE FROM ZB_RCVBL_TRACKER where PCN = ? and ACCNO=? and TRANCD = ? and LOB_TIMESTAMP = ?
Hi All,
I have a root directory /tmp and I want to purge files or archive files in its subsequent subfolders.I listed the path of files I want to purge(archive) and the #of days.
(purge)
DAYS PATH
7 /tmp/arsenal/*
5 /tmp/chelsea/*
(archive?
the same as above but different folders... (15 Replies)
Would appreciate if any one can paste a generic schell script to archive a file with date stamp by passing the file with fullpath as parameter
For Eg. /apps/scripts/Archive_File.sh /data_home/project_home/file.txt
this should place the file in the following directory
... (8 Replies)
Hi,
I am writing a shell script for archive data from a table.
The design is as follows.
Step 1:
Execute the select query and extract the data into a text file.
Step 2:
The primary key for this table is TRACKING_NUM, TRACKING_NUM_SUFFIX, TIMESTAMP_UPDATED. So These three fields will be read... (1 Reply)
Hi All,
OS:AIX 5.3 64 bits
I would like the below script to send alert mail with the message - "Standby logs falling behind Primary" to xyz@yahoo.com
Script
=====
#!/usr/bin/ksh
#-----------------------------------------------------------------------------
# Use SQL*Plus to query... (1 Reply)
I'm new to shell scripting... i have been given a task.. can any one help in this regard....
1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check... (1 Reply)
Hello, I found the forum’s information very helpful and informative. I am relatively new to UNIX programming. I am researching how to write a UNIX shell script to ftp all files from specific host folder to a client server. Also need to archive all transferred files, send a message (email) if any... (4 Replies)
Hi Friends,
I have an urgent requirement.
I have many files huge in size which has occupied almost the entire disk space. The files are not being moved to the archived folder.
But at present I need to purge those files, new to shell scripting, not sure how to proceed.
Eg.
Directory... (3 Replies)
Hi,
I'm new to Unix shell scripting and my first task is proving to be tricky.
Please help where you can with pointers, tips, or examples of script.
I'm self learning from the internet.
I need to archive off files to another write protected directory according to the file names.
ex.... (0 Replies)
Hi Unix Experts,
I am new in this filed.
I have assignment to Archive and purge the log file using shell scripts I tried I could not get the result please help me this.
Ex: test.log
requirement : using shell script I need to archive the log file and nil and the content of (test.log)... (1 Reply)
Hello All,
I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60%
Need to identify the unique file system that reaches threshold value.
ex:
capacity
... (4 Replies)
Discussion started by: sasikanthdba
4 Replies
LEARN ABOUT REDHAT
delete
DELETE(7) SQL Commands DELETE(7)NAME
DELETE - delete rows of a table
SYNOPSIS
DELETE FROM [ ONLY ] table [ WHERE condition ]
INPUTS
table The name (optionally schema-qualified) of an existing table.
condition
This is an SQL selection query which returns the rows which are to be deleted.
Refer to the SELECT statement for further description of the WHERE clause.
OUTPUTS
DELETE count
Message returned if items are successfully deleted. The count is the number of rows deleted.
If count is 0, no rows were deleted.
DESCRIPTION
DELETE removes rows which satisfy the WHERE clause from the specified table.
If the condition (WHERE clause) is absent, the effect is to delete all rows in the table. The result is a valid, but empty table.
Tip: TRUNCATE [truncate(7)] is a PostgreSQL extension which provides a faster mechanism to remove all rows from a table.
By default DELETE will delete tuples in the table specified and all its sub-tables. If you wish to only update the specific table men-
tioned, you should use the ONLY clause.
You must have write access to the table in order to modify it, as well as read access to any table whose values are read in the condition.
USAGE
Remove all films but musicals:
DELETE FROM films WHERE kind <> 'Musical';
SELECT * FROM films;
code | title | did | date_prod | kind | len
-------+---------------------------+-----+------------+---------+-------
UA501 | West Side Story | 105 | 1961-01-03 | Musical | 02:32
TC901 | The King and I | 109 | 1956-08-11 | Musical | 02:13
WD101 | Bed Knobs and Broomsticks | 111 | | Musical | 01:57
(3 rows)
Clear the table films:
DELETE FROM films;
SELECT * FROM films;
code | title | did | date_prod | kind | len
------+-------+-----+-----------+------+-----
(0 rows)
COMPATIBILITY
SQL92
SQL92 allows a positioned DELETE statement:
DELETE FROM table WHERE
CURRENT OF cursor
where cursor identifies an open cursor. Interactive cursors in PostgreSQL are read-only.
SQL - Language Statements 2002-11-22 DELETE(7)