View Full Version : BAT files command.
Immortal
01-27-05, 02:01 PM
Can I get a list of all the bat commands? I tried to find it but I can't... thanks alot...
Sorry it it's kinda stupid question... thanks agian.
In Win XP Start>Run
%systemroot%\hh.exe mk:@MSITStore: %systemroot%\help\ms-its:ntcmds.chm::/batch.htmShows all batch commands
Start>Run
%systemroot%\hh.exe mk:@MSITStore: %systemroot%\help\ms-its:ntcmds.chm::/ntcmds.htmShows all the Win XP commands that can be run from a batch file, or the command line.
Have fun :)
TinyTim
01-27-05, 03:12 PM
Cool, thanks Norm! :thumb:
here's the whole ms command line reference online (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx)
Immortal
01-30-05, 04:31 PM
Thanky.. I've been trying to write a bat file to create a database in oracle. It's my first assigment and I can't make it work!#$@#$@#$@#
Anyoen know anything about oracle and starting it up with bat files? I'm pretty darn close but it keeps telling me tns error or some sort.
http://www.experts-exchange.com/Databases/Q_20909881.html
Immortal
01-30-05, 05:47 PM
http://www.experts-exchange.com/Databases/Q_20909881.html
Thanks I did that but it still doesn't run right.. I must be missing something but not in teh bat file probably..
thanks..
Immortal
01-30-05, 07:52 PM
post the sql commands
SQL*Plus: Release 9.2.0.1.0 - Production on Sun Jan 30 20:41:40 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
ORACLE instance started.
Total System Global Area 30480768 bytes
Fixed Size 452992 bytes
Variable Size 20971520 bytes
Database Buffers 8388608 bytes
Redo Buffers 667648 bytes
ORA-00205: error in identifying controlfile, check alert log for more info
CREATE TABLESPACE TEMP DATAFILE 'C:\ITM610W05901_G03\newdata\TEMP01_G03.dbf' SIZ
E 2M AUTOEXTEND ON NEXT 2M MAXSIZE 20M
*
ERROR at line 10:
ORA-02165: invalid option for CREATE DATABASE
SQL>
this is what I got in the dos promt..
ORA-00205: error in identifying controlfile, check alert log for more info <-- ??
The sql file that I executed that.
--set echo on
startup pfile=C:\ITM610W05901_G03\newadmin\init.ora;
CREATE DATABASE DB901G03
MAXDATAFILES 50
MAXINSTANCES 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXLOGHISTORY 1
LOGFILE GROUP 1 ('C:\ITM610W05901_G03\newlog\REDO0101.log') SIZE 1M, GROUP 2
('C:\ITM610W05901_G03\newlog\REDO0201.log') SIZE 1M
DATAFILE 'C:\ITM610W05901_G03\newdata\SYSTEM01.dbf' SIZE 100M AUTOEXTEND ON NEXT 5M
UNDO TABLESPACE UNDOTBS DATAFILE 'C:\ITM610W05901_G03\newdata\UNDO01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT
1M MAXSIZE 10M
CREATE TABLESPACE TEMP DATAFILE 'C:\ITM610W05901_G03\newdata\TEMP01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 2M
MAXSIZE 20M
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16;
And here's the init.ora file that was called in the sql...
###########################################
# Database Identification
###########################################
db_name=DB901G03
db_domain=""
###########################################
# Instance Identification
###########################################
instance_name=DB901G03
###########################################
# Block and Cache Size
###########################################
db_block_size=4096
db_cache_size=5M
###########################################
# Pools
###########################################
shared_pool_size=5M
java_pool_size=0
large_pool_size=0
###########################################
# File Configuration
###########################################
control_files=C:\ITM610W05901_G03\newlog\CONTROL01.ctl
###########################################
# Password
###########################################
remote_login_passwordfile=EXCLUSIVE
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_retention=10800
undo_tablespace=UNDOTBS
###########################################
# Dumps
###########################################
background_dump_dest=C:\ITM610W05901_G03\newadmin\bdump
core_dump_dest=C:\ITM610W05901_G03\newadmin\cdump
user_dump_dest=C:\ITM610W05901_G03\newadmin\udump
THANKS A BUNCCCHHHH! (kisses and hugs) xoxoxoxoxo
Immortal
02-01-05, 01:35 AM
Ignore the stuff on top.. right now I'm closer to the goal. Still not there... here's the current batch file...
REM CODE STARTS
REM Sets the variable to our OFA source directory
set setup_source=C:\ITM610W05901_G03
REM Sets the variable to our SID
set oracle_sid=DB901G03
REM Oracle home
set oracle_home=C:\oracle\ora92\
REM Create Directories
if not exist c:\D1 mkdir c:\D1
if not exist c:\D2 mkdir c:\D2
if not exist c:\D3 mkdir c:\D3
if not exist c:\D4 mkdir c:\D4
if not exist c:\D5 mkdir c:\D5
REM Making Directories
if not exist %setup_source%\newdata mkdir %setup_source%\newdata
if not exist %setup_source%\newlog mkdir %setup_source%\newlog
if not exist %setup_source%\rdbms mkdir %setup_source%\rdbms
if not exist %setup_source%\rdbms\admin mkdir %setup_source%\rdbms\admin
if not exist %setup_source%\newadmin mkdir %setup_source%\newadmin
if not exist %setup_source%\database mkdir %setup_source%\database
if not exist %setup_source%\temp\ mkdir %setup_source%\temp
REM Copy init.ora
if not exist %setup_source%\newadmin\init.ora copy %setup_source%\init.ora %setup_source%\newadmin\
REM Copy Tnsnames.ora
if not exist %setup_source%\newadmin\tnsnames.ora copy %setup_source%\tnsnames.ora %setup_source%\newadmin\
REM Copy Listener.ora
if not exist %setup_source%\newadmin\listener.ora copy %setup_source%\listener.ora %setup_source%\newadmin\
REM Creates ORADIM (Windows Service)
oradim -new -sid DB901G03 -startmode m -pfile %setup_source%\newadmin\init.ora
REM Creates ORAPWD (Password File)
orapwd file=%setup_source%\database\pwdDB901G03.ora password=oracle entries=5
REM Running commands
sqlplus "sys/oracle AS SYSDBA" @C:\ITM610W05901_G03\createDB_G03.sql
Here's the Create DB.sql
set echo on
startup nomount pfile=C:\ITM610W05901_G03\newadmin\init.ora
CREATE DATABASE DB901G03
MAXDATAFILES 50
MAXINSTANCES 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXLOGHISTORY 1
LOGFILE GROUP 1 ('C:\ITM610W05901_G03\newlog\REDO0101.log') SIZE 1M, GROUP 2 ('C:\ITM610W05901_G03\newlog\REDO0201.log') SIZE 1M
DATAFILE 'C:\ITM610W05901_G03\newdata\SYSTEM01.dbf' SIZE 100M AUTOEXTEND ON NEXT 5M
UNDO TABLESPACE UNDOTBS DATAFILE 'C:\ITM610W05901_G03\newdata\UNDO01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 1M MAXSIZE 10M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'C:\ITM610W05901_G03\newdata\TEMP01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 2M MAXSIZE 20M
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16;
Everything basically works Except I get this error... :
SQL> CREATE DATABASE DB901G03
2 MAXDATAFILES 50
3 MAXINSTANCES 1
4 MAXLOGFILES 5
5 MAXLOGMEMBERS 3
6 MAXLOGHISTORY 1
7 LOGFILE GROUP 1 ('C:\ITM610W05901_G03\newlog\REDO0101.log') SIZE 1M, GROUP
2 ('C:\ITM610W05901_G03\newlog\REDO0201.log') SIZE 1M
8 DATAFILE 'C:\ITM610W05901_G03\newdata\SYSTEM01.dbf' SIZE 100M AUTOEXTEND ON
NEXT 5M
9 UNDO TABLESPACE UNDOTBS DATAFILE 'C:\ITM610W05901_G03\newdata\UNDO01_G03.db
f' SIZE 2M AUTOEXTEND ON NEXT 1M MAXSIZE 10M
10 DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'C:\ITM610W05901_G03\newdata\TEM
P01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 2M MAXSIZE 20M
11 CHARACTER SET WE8ISO8859P1
12 NATIONAL CHARACTER SET AL16UTF16;
CREATE DATABASE DB901G03
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL>
No matter what I do the thing won't end. As soon as I put ; at the end signalling the end of the sql. It executes the 'create database...' command again. I can put the ; at the end of any command and the next one will automatically be 'create database' then the error.
I tried many many things. Searched many sites and can't find the error... any help is much appreciated... THANKSSSS :D
Immortal
02-01-05, 01:53 AM
It's trying to execute the create db.sql twice! Why.. geezus...
Sometimes it just takes too long and times out or somet sort... why though.
not sure, but with mySQL, the first command is a "mySQL CONNECT" and the last is a "mySQL CLOSE", which opens and closes the connection to it.
Immortal
02-01-05, 12:37 PM
not sure, but with mySQL, the first command is a "mySQL CONNECT" and the last is a "mySQL CLOSE", which opens and closes the connection to it.
Thanks tony but that's not it.... :(
Why is this stuff not in the boook... I have to go ask the prof probably... thanks again..
cyberskye
02-01-05, 01:25 PM
Check the alert.log - it's in your background_dump_dest
Edit - sorry - you are looking for traces for the tnslistener. That error means that you cannot connect. Since Oracle is up, I assume the port values are misconfigured.
EditEdit - you should have mentioned oracle in the subject line - I don't know windows command line so I just looked at this thread today. ;)
Skye
Immortal
02-01-05, 01:45 PM
oh okay... Everything runs fine now.. except it doesn't want to stop executing the .sql file.
I'm about to cry... this thing is so simple and I spent so much time on it.
cyberskye
02-01-05, 01:50 PM
Clarify - did you make any changes around tnslistener? Do you still get that error message or you are just double-dipping the sql?
Immortal
02-01-05, 04:27 PM
No tns error of any sort.
It just double executing the sql file. Nothing is wrong other than that. thanks again. I'm at my wits end...
here's the listener
# LISTENER.ORA Network Configuration File: C:\oracle\ora92\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = oraclass)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = oraclass)
)
(SID_DESC =
(GLOBAL_DBNAME = DB901G03)
(ORACLE_HOME = c:\oracle\ora92)
(SID_NAME = DB901G03)
)
)
here's the TNSNAMES
# TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLASS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclass)
)
)
DB901G03 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DB901G03)
)
)
cyberskye
02-01-05, 06:07 PM
Hmmm.
Have you tried adding the exit or quit commands to exit sqlplus after the script runs?
I ask because you mentioned semicolon repeating the script. ' ; ' accesses the command buffer (scroll chronologically thru previous commands), which could cause it to re-execute the script.
Reaching here, it's been a while since I've gotten dirty with this.
Skye
Immortal
02-01-05, 06:13 PM
I tried exit, quit, close, disconnect and none of them worked. sadly... I'll try once more..
Even after I put exit then ;
it won't even read the exit command and just go back to 'create database' or just get stuck... ew
I don't know why... I've looked through this like a billion times and I can't find a fault.
Immortal
02-01-05, 06:26 PM
here's what I get when I do it with the exit command.. it just tries to do the darn command again... why oh lord... It's probably something stupid too.. :(
SQL> startup nomount pfile=C:\ITM610W05901_G03\newadmin\init.ora
ORACLE instance started.
Total System Global Area 30480768 bytes
Fixed Size 452992 bytes
Variable Size 20971520 bytes
Database Buffers 8388608 bytes
Redo Buffers 667648 bytes
SQL> CREATE DATABASE DB901G03
2 MAXDATAFILES 50
3 MAXINSTANCES 1
4 MAXLOGFILES 5
5 MAXLOGMEMBERS 3
6 MAXLOGHISTORY 1
7 LOGFILE GROUP 1 ('C:\ITM610W05901_G03\newlog\REDO0101.log') SIZE 1M, GROUP
2 ('C:\ITM610W05901_G03\newlog\REDO0201.log') SIZE 1M
8 DATAFILE 'C:\ITM610W05901_G03\newdata\SYSTEM01.dbf' SIZE 100M AUTOEXTEND ON
NEXT 5M
9 UNDO TABLESPACE UNDOTBS DATAFILE 'C:\ITM610W05901_G03\newdata\UNDO01_G03.db
f' SIZE 2M AUTOEXTEND ON NEXT 1M MAXSIZE 10M
10 DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'C:\ITM610W05901_G03\newdata\TEM
P01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 2M MAXSIZE 20M
11 CHARACTER SET WE8ISO8859P1
12 NATIONAL CHARACTER SET AL16UTF16
13 exit;
exit
*
ERROR at line 13:
ORA-02165: invalid option for CREATE DATABASE
SQL>
cyberskye
02-01-05, 06:31 PM
try it with a semicolon at teh end of teh CREATE statement (line 12) without changing anything else?
Immortal
02-01-05, 06:41 PM
try it with a semicolon at teh end of teh CREATE statement (line 12) without changing anything else?
tried that.. it'll try and execute the 'Create database DB901G03' command and give me teh e3rror cos I'm not connected.
I appreciate all ur help. Thanks.
cyberskye
02-01-05, 06:42 PM
That's all I've got. Good luck with this. Please post the resolution.
Immortal
02-01-05, 06:44 PM
That's all I've got. Good luck with this. Please post the resolution.
Thanks alot! :D
I'll keep at it.. i know it's probably something silly too... I just can't see it...
cyberskye
02-03-05, 12:19 AM
<bump>
How did it go?
Immortal
02-03-05, 12:59 AM
still at it.. :(
Asked the prof and I just changed all the directories to hte OFA structure. but anytime I put in the ; it tries to execute everthing that has already been executed again.
Same old problem!: ( It's due friday... I hope the data fairy comes and help me..
cyberskye
02-03-05, 02:35 AM
I'll ask our DBA tomorrow. He's an Oracle Jedi.
Please post the latest version of all of your oracle files, the sql, and the bat all in one post.
Skye
Immortal
02-03-05, 03:21 AM
Okay I figured out what the problem is... There's no problem with the files.
The problem that it double executes is that after I do the 'Create Database' command... it stores everything into a buffer until I issue terminate and execute with ;
but with ; or / it executes the current command and tries to do whatever is in the buffer once again. If I type in list ... it shows me all the commands I just executed since 'Create Database'. How do I stop it from double executing... how do I disable the buffer.. pl/sql I believe.
Thanks alot skype... Really appreciate it.
Immortal
02-03-05, 03:23 AM
set echo on
startup nomount pfile=C:\D1\ORACLE\ADMIN\DB901G03\pfile\init.ora
clear buffer
CREATE DATABASE DB901G03
MAXDATAFILES 50
MAXINSTANCES 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXLOGHISTORY 1
DATAFILE 'C:\D1\ORACLE\ADMIN\DB901G03\SYSTEM01.dbf' SIZE 100M AUTOEXTEND ON NEXT 5M
UNDO TABLESPACE UNDOTBS DATAFILE 'C:\D5\ORACLE\ORADATA\DB901G03\UNDO01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 1M MAXSIZE 10M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'C:\D5\ORACLE\ORADATA\DB901G03\TEMP01_G03.dbf' SIZE 2M AUTOEXTEND ON NEXT 2M MAXSIZE 20M
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('C:\D3\ORACLE\ORADATA\DB901G03\REDO0101.log') SIZE 1M, GROUP 2 ('C:\D4\ORACLE\ORADATA\DB901G03\REDO0201.log') SIZE 1M;
set echo off
exit
This is the create DB.sql file I'm executing. Everything else should be in tip top shape. The prof checked it and said it's fine... thanks again...
cyberskye
02-03-05, 09:37 PM
Sorry - the DBA was out today and the other guys only speak Russian :) I'll hit him up tomorrow if he's in or get an interpreter
This should be easy enough.
BTW - did you try adding the clear buffer statement just before echo off ?
Might be worth a try - it's more appropriate at the end than the begging anyway
Immortal
02-04-05, 12:35 AM
I tried the clear buffer and del commands... however it executes it twice after I put in ; or / . then it excutes the clear buffer...
I tried putting clear/del before I put in ; but it's not part of the 'create database command'
I don't know, I have an appointment with the prof tomorrow... I'm sure he can fix it or else.. I slap him.. heh..
Thanks again for all the troubles eh!
Immortal
02-04-05, 10:35 PM
Showed the prof.. prof says everything seems to be in order and went... 'Hmmmm'
Took my files and went home to test it on his machine... Woo! So I'm not the only stupid one! yay.
cyberskye
02-05-05, 12:13 AM
My DBA asked if you were using both " / " and " ; " in the same command - each does the same thing, but using *both* in the same script (probably in different places) will cause the buffer to be executed again. Be consistent in whichever you choose.
Can't tell from your samples if that is the case.
Immortal
02-05-05, 02:15 AM
yeah, I didn't do both.. I'm saying what ur dba is saying as well.. No matter which one I used it does the same thing.
Well at least the prof agrees that this is an odd problem and that I'm not an idiot.. so that makes me feel good.. heh..
Thanks alot skye! I'd kiss u if I could. .heh
cyberskye
02-05-05, 03:04 PM
Cheers - post back the resolution (if there ever is one)
Skye
Immortal
02-06-05, 05:38 PM
Here's the solution...
To fix this error you must add the following parameter in the initialization parameter file (init.ora):
COMPATIBLE=9.0.0.0.0
We have to make it compatible to an earlier version or something.. then it runs perfectly. Nothing wrong with the code at all..
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.