Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Startup via SQL Embedded
Hi,
Some guys have disagreed completely with the possibility of to startup an Oracle instance from an user application.
At first glance, I've agreed with them.
But, till know, they neither ensure me that it's impossible nor give the a consistent list of reasons to don't do that.
I am not convinced that I will start the db instance via application; I'm just studying possibilities.
How I said before, if it is possible, I prefer starting via SQL Embedded.
I've done a C program that is able to start the Oracle db instance since the user who executed it be a member of "dba" Unix group. It uses a system call to "sqlplus".
The "CONNECT INTERNAL" would be used by application just to start the instance; for "normal" application procedures, it would use a normal "CONNECT <user>/<passwd>@<alias>". It's prohibited to use a CONNECT INTERNAL or CONNECT SYSTEM for other purposes than db instance startup.
And the application would execute its normal procedures by SQL Embedded.
(Thanks Rick Wessman for your considerations, but) How can this setup corrupt the db?
The C program startup_db.c follows:
(to compile use "gcc startup_db.c -o startup_db", at the
Unix - Solaris - command line)
#include <stdio.h> #include <stdlib.h> #include <errno.h>
int main()
{
const char *svrmgrl_cmd_start =
"svrmgrl <<EOF\nCONNECT INTERNAL\nSTARTUP OPEN\nEOF";
const char *sqlplus_cmd_start =
"sqlplus /NOLOG <<EOF\n"
"WHENEVER SQLERROR EXIT SQL.SQLCODE\n"
"WHENEVER OSERROR EXIT FAILURE\n"
"CONNECT / AS SYSDBA\n"
"STARTUP OPEN\n"
"SELECT USER FROM DUAL;\n"
"EOF";
int sqlerrornumber;
if ( (sqlerrornumber = system( sqlplus_cmd_start )) == 0 )
{
fprintf( stdout, "DB started successfully\n" );
}
else
{
fprintf( stdout, "DB not started. sql error number = %d. errno = %d\n",
sqlerrornumber, errno );
}
}
See you,
thanks,
Renato Fabiano
Rick Wessman <Rick.Wessman_at_oracle.com> wrote in message
> IMO, this setup is a recipe for disaster. An application should never have the > dba role, either internally or externally granted. Otherwise, an application > error could corrupt the database. > > Using the script run at boot time should suffice. If the database does not > come up at that point, the odds are quite high that it will not come up when > the application tries to start it. > > RickReceived on Wed Oct 17 2001 - 08:29:21 CDT
![]() |
![]() |