Re: Automation and dbaccess
Posted in 2000
Chris Pope wrote:
> Now how do I kill the users?
No handguns or knives allowed!
> I need to find out the users of the database and kill them first and do this
> all w/o manual intervention...
Why would you be *wanting* to drop a database that users are still
using? That is a most unusual requirement. I seriously question
whether what you are seeking to do is really desirable.
However, you can go poking around the output of 'onstat -u' to find the
processes that you need to kill. Or you can simply use 'onmode -ky' to
take the instance offline forcibly and then use 'oninit -s' to bring it
up single-user and drop the database and then take it multi-user (oninit
-m, IIRC). Most of this does not use DB-Access, and therefore I'm not
answering your real question...
But I still think that wanting to drop a database that is in active use
indicates a big design problem of some sort and you would be better off
describing what you're really trying to do and why, so we can help you
devise a better mechanism than dropping the database.
> "Bogdan Neagu" <bogdan.neagu@alcatel.com> wrote:
> > Finally I read the initial message. Sorry.
> > I guess the syntax will be
> >
> > echo 'drop database <database>;'| dbaccess - -
> >
> > Chris Pope wrote:
> >
> > > That would drop a table..I presume.
> > > Would the sytax for dropping a database be
> > >
> > > echo 'drop database <database>;'| dbaccess <databasename> -
> > >
> > > ?
> > >
> > > "Bogdan Neagu" <bogdan.neagu@alcatel.com> wrote:
> > > > If you are on UNIX:
> > > >
> > > > echo 'drop table <tablename>;' | dbaccess <databasename> -
> > > >
> > > > Chris Pope wrote:
> > > > > Hi, I'm a neophyte Informix DBA. I'm trying to figure out how to automate
> > > > > the dropping of a database. I need to kill all the sessions and drop the
> > > > > database. How can I automate dbaccess to do this?
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"