| Neeraj |
Posted: Feb 26, 2008 04:06:57 AM |
Total Post: 228
Joined: Jan, 2007
|
hi,
anyone can tell me how to make batch file for using sql commands ?
thxs |
|
|
MOH_DBA |
| Posted: Feb 27, 2008 03:51:36 PM | |
|
Total Post: 123
Joined: Nov, 2007
|
You first create the patch file(C:\file.bat) and put in this file the following:
conn username/password@database @C:\sqlfile.sql
then create the sql file and put what ever you want in it.
|
|
|
|
|
MOH_DBA |
| Posted: Feb 27, 2008 03:53:59 PM | |
|
Total Post: 123
Joined: Nov, 2007
|
Sorry: you put instead of the (conn) sqlplus to be as follow:
sqlplus username/password@database @C:\sqlfile.sql
|
|
|
|
|
Neeraj |
| Posted: Feb 28, 2008 03:50:05 AM | |
|
Total Post: 228
Joined: Jan, 2007
|
hi,
thxs but i want to know how to use sql command in this batch file ,like how to vreate a varable & want to store some value in it,
like i want to store date in a variable using batch file, tell me how to do it .
thxs
|
|
|
|
|
MOH_DBA |
| Posted: Feb 28, 2008 02:54:17 PM | |
|
Total Post: 123
Joined: Nov, 2007
|
download from the link below the file name (backup.zip)
this file has good example of what i understand you want.
Hope that will help.
http://ourworld.compuserve.com/homepages/Peter_Koletzke/tip.htm#expname
|
|
|
|
|
Neeraj |
| Posted: Feb 29, 2008 03:31:30 AM | |
|
Total Post: 228
Joined: Jan, 2007
|
thxs but it didnt help me a lot, i m still searching .
|
|
|
|
|
MOH_DBA |
| Posted: Mar 01, 2008 03:19:21 PM | |
|
Total Post: 123
Joined: Nov, 2007
|
help me to understand,
You want to store some variables that are taken from sql commands and use them in a batch file?
|
|
|
|
|
Neeraj |
| Posted: Mar 03, 2008 12:14:07 AM | |
|
Total Post: 228
Joined: Jan, 2007
|
as i told u i get backup of my database as i described above ,its stored as date wise like dubp_02032008
i cant store only 2 dump so i got to delete dump b4 2 days ,i want to do it automatcially when i get 2nd dump after that batch shud delete 2 days b4 dump itself.
i dont know how to do it useing dos command in batch file how to get date of 2 days back. so i though i careat a batch file in that i can hav a variable that can store date of 2 days back then ibatch file can use that date & delte dump of that date.
now suggest me how to perform it.
thxs
|
|
|
|
|
MOH_DBA |
| Posted: Mar 03, 2008 03:59:34 PM | |
|
Total Post: 123
Joined: Nov, 2007
|
I can give you this suggestion but it have limitation, it's limitation is, when a new month begin you need to delete the file manual but during the month it will work correctly. my suggestion is to convert date to number and substract 2 days from it. like this:
1) change the format of the date(from regional and language setting) to yyyy-mm-dd.
2) put the following in your batch file:
C:\>set today=%date:~-10%
C:\>SET today=%today: =%
C:\>SET today=%today:-=% or C:\>SET today=%today:/=% (depend on the seperator)
3) do the export : file=%today%.dmp
4)set /A today=%today:~-8% -2
del C:\%today%.dmp
but as i said hope to consider the limitation.
hope that will help you.
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |