11-10-2009
Need help on Shell script for database maintainace..
Hi All,
I have to perform some tasks for database maintainace. I am using postgresql on RHEL 4.4.
1) I have to run "vacuumedb" on the database as postgres user.
2) I have to reindex the database as postgres user.
Now i want to write shell script to do these tasks one after another. Please any one suggest me, how to write a shell script..
Thanks in advance..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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)
Discussion started by: johnray31
7 Replies
2. Shell Programming and Scripting
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)
Discussion started by: ring
1 Replies
3. Shell Programming and Scripting
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (2 Replies)
Discussion started by: alokjyotibal
2 Replies
4. Shell Programming and Scripting
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)
Discussion started by: smarty86
1 Replies
5. Shell Programming and Scripting
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)
Discussion started by: ravi214u
1 Replies
6. Shell Programming and Scripting
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)
Discussion started by: ali560045
1 Replies
7. Shell Programming and Scripting
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)
Discussion started by: satyakiran
8 Replies
8. Shell Programming and Scripting
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)
Discussion started by: sachinkl
3 Replies
9. Shell Programming and Scripting
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)
Discussion started by: bshivali
8 Replies
10. Shell Programming and Scripting
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 SUSE
alter_database
ALTER
DATABASE(7) SQL Commands ALTER DATABASE(7)
NAME
ALTER DATABASE - change a database
SYNOPSIS
ALTER DATABASE name [ [ WITH ] option [ ... ] ]
where option can be:
CONNECTION LIMIT connlimit
ALTER DATABASE name RENAME TO newname
ALTER DATABASE name OWNER TO new_owner
ALTER DATABASE name SET TABLESPACE new_tablespace
ALTER DATABASE name SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name SET configuration_parameter FROM CURRENT
ALTER DATABASE name RESET configuration_parameter
ALTER DATABASE name RESET ALL
DESCRIPTION
ALTER DATABASE changes the attributes of a database.
The first form changes certain per-database settings. (See below for details.) Only the database owner or a superuser can change these set-
tings.
The second form changes the name of the database. Only the database owner or a superuser can rename a database; non-superuser owners must
also have the CREATEDB privilege. The current database cannot be renamed. (Connect to a different database if you need to do that.)
The third form changes the owner of the database. To alter the owner, you must own the database and also be a direct or indirect member of
the new owning role, and you must have the CREATEDB privilege. (Note that superusers have all these privileges automatically.)
The fourth form changes the default tablespace of the database. Only the database owner or a superuser can do this; you must also have
create privilege for the new tablespace. This command physically moves any tables or indexes in the database's old default tablespace to
the new tablespace. Note that tables and indexes in non-default tablespaces are not affected.
The remaining forms change the session default for a run-time configuration variable for a PostgreSQL database. Whenever a new session is
subsequently started in that database, the specified value becomes the session default value. The database-specific default overrides
whatever setting is present in postgresql.conf or has been received from the postgres command line. Only the database owner or a superuser
can change the session defaults for a database. Certain variables cannot be set this way, or can only be set by a superuser.
PARAMETERS
name The name of the database whose attributes are to be altered.
connlimit
How many concurrent connections can be made to this database. -1 means no limit.
newname
The new name of the database.
new_owner
The new owner of the database.
new_tablespace
The new default tablespace of the database.
configuration_parameter
value Set this database's session default for the specified configuration parameter to the given value. If value is DEFAULT or, equiva-
lently, RESET is used, the database-specific setting is removed, so the system-wide default setting will be inherited in new ses-
sions. Use RESET ALL to clear all database-specific settings. SET FROM CURRENT saves the session's current value of the parameter
as the database-specific value.
See SET [set(7)] and in the documentation for more information about allowed parameter names and values.
NOTES
It is also possible to tie a session default to a specific role rather than to a database; see ALTER ROLE [alter_role(7)]. Role-specific
settings override database-specific ones if there is a conflict.
EXAMPLES
To disable index scans by default in the database test:
ALTER DATABASE test SET enable_indexscan TO off;
COMPATIBILITY
The ALTER DATABASE statement is a PostgreSQL extension.
SEE ALSO
CREATE DATABASE [create_database(7)], DROP DATABASE [drop_database(7)], SET [set(7)], CREATE TABLESPACE [create_tablespace(7)]
SQL - Language Statements 2010-05-14 ALTER DATABASE(7)