You could also use "sudo" to allow another user to be the postgres user for these commands; see Using sudo
Hi,
Thanks for the reply, My senario is given below..
In the above activity there is an interactive command "Reindex Database", I can't call this command in to a shell script. I want to do this activity without my interaction. Please suggest me what to do...
Last edited by vbe; 11-13-2009 at 05:44 AM..
Reason: added code tags...
Hi All,
Language like C,Java can interact with database..and can use database information .. can a shall script do this?
if yes thn plz guide me.....
thankx (7 Replies)
Hi ,
I am new to linux and also also to shell scripting.
I have one shell script which unpacks .tgz file and install software on machine.
When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Input for the program is a text file consisting of n no. of items.
I want search each item in a database and the existing parts should go to FOUND folder and the others should go to NOTFOUND folder.
Pls help me in this.
Thank u. (1 Reply)
Hi
when i am calling the shell script with two parameter like id and date it works fine.But the same shell script is call by java application it gives the error as shown below
Thu Jan 8 04:13:22 EST 2009|The Get Segment Process Failed: SP2-0306:
Invalid option.
Usage: CONN where <logon>... (1 Reply)
hi,
I have a script that will logon to a database siebel and do the select query and then get the result in command prompt of unix.Below the script.
#!/bin/ksh
. $HOME/conf/systemProperties/EnvSetup.properties
#set -x
while read i
do
echo $i
connect1=`sqlplus -silent... (1 Reply)
Hi all,
I am satyakiran , i am new to the forum. i never done shell scripts for connecting to the data base (oracle) and fetching the data from the database( thru sql select statements ) i want to know
1. how to connect to the data base(oracle) using shell script
2. how to retrieve data... (8 Replies)
Hi all,
This is my first ever post to any forum so, dont let this go in vain...........:)
Here is the scenario........
I have logged into the unix where oracle_sid is initialized for some X database in the .profile.
I have a unix script where some sql query which fetches data from X... (3 Replies)
Hi Unix Gurus,
I have a requirement to write a script, Oracle DB gets referesh every 6hrs, hence we need write a script to connect to the database , if it connects it should generate a file to proceed the next job application or when an error when connectiong to DB it should not generate any... (8 Replies)
Hi All,
I am newbie to unix shell scripting. I want to connect to oracle database using shell script. I know how to connect DB using user name and password but my question is if my password is having '@' sign then how to connect.
I have tried like below,
cnt=`sqlplus -s /nolog << EOFSQL
... (3 Replies)
Discussion started by: pmotewar
3 Replies
LEARN ABOUT REDHAT
reindex
REINDEX(7) SQL Commands REINDEX(7)NAME
REINDEX - rebuild corrupted indexes
SYNOPSIS
REINDEX { TABLE | DATABASE | INDEX } name [ FORCE ]
INPUTS
TABLE Recreate all indexes of a specified table.
DATABASE
Recreate all system indexes of a specified database. (User-table indexes are not included.)
INDEX Recreate a specified index.
name The name of the specific table/database/index to be reindexed. Table and index names may be schema-qualified.
FORCE Force rebuild of system indexes. Without this keyword REINDEX skips system indexes that are not marked invalid. FORCE is irrelevant
for REINDEX INDEX, or when reindexing user indexes.
OUTPUTS
REINDEX
Message returned if the table is successfully reindexed.
DESCRIPTION
REINDEX is used to rebuild corrupted indexes. Although in theory this should never be necessary, in practice indexes may become corrupted
due to software bugs or hardware failures. REINDEX provides a recovery method.
REINDEX also removes certain dead index pages that can't be reclaimed any other way. See the "Routine Reindexing" section in the manual for
more information.
If you suspect corruption of an index on a user table, you can simply rebuild that index, or all indexes on the table, using REINDEX INDEX
or REINDEX TABLE.
Note: Another approach to dealing with a corrupted user-table index is just to drop and recreate it. This may in fact be preferable
if you would like to maintain some semblance of normal operation on the table meanwhile. REINDEX acquires exclusive lock on the ta-
ble, while CREATE INDEX only locks out writes not reads of the table.
Things are more difficult if you need to recover from corruption of an index on a system table. In this case it's important for the backend
doing the recovery to not have used any of the suspect indexes itself. (Indeed, in this sort of scenario you may find that backends are
crashing immediately at start-up, due to reliance on the corrupted indexes.) To recover safely, the postmaster must be shut down and a
stand-alone PostgreSQL backend must be started instead, giving it the command-line options -O and -P (these options allow system table mod-
ifications and prevent use of system indexes, respectively). Then issue REINDEX INDEX, REINDEX TABLE, or REINDEX DATABASE depending on how
much you want to reconstruct. If in doubt, use REINDEX DATABASE FORCE to force reconstruction of all system indexes in the database. Then
quit the standalone backend and restart the postmaster.
Since this is likely the only situation when most people will ever use a standalone backend, some usage notes might be in order:
o Start the backend with a command like
postgres -D $PGDATA -O -P my_database
Provide the correct path to the database area with -D, or make sure that the environment variable PGDATA is set. Also specify the name
of the particular database you want to work in.
o You can issue any SQL command, not only REINDEX.
o Be aware that the standalone backend treats newline as the command entry terminator; there is no intelligence about semicolons, as there
is in psql. To continue a command across multiple lines, you must type backslash just before each newline except the last one. Also, you
won't have any of the conveniences of command-line editing (no command history, for example).
o To quit the backend, type EOF (Control+D, usually).
See the postgres(1) reference page for more information.
USAGE
Recreate the indexes on the table mytable:
REINDEX TABLE mytable;
Rebuild a single index:
REINDEX INDEX my_index;
Rebuild all system indexes (this will only work in a standalone backend):
REINDEX DATABASE my_database FORCE;
COMPATIBILITY
SQL92
There is no REINDEX in SQL92.
SQL - Language Statements 2002-11-22 REINDEX(7)