DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: CreateDatabase Script

  1. #1
    Join Date
    Oct 2000
    Posts
    449
    Hi Guys: we have script that creates database. I mean the create DB statement with mentioning of log files and system files etc., One of the user accidentally ran the same on the existing database. But to prevent the same the script has to be smart enogh to check the existance of the db and if so, comeout successfully, if not go ahead and create one..
    What is the best way to check this? Any ideas??

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    move your createdb script to a secure location so anybody can not run it...
    Jeff Hunter

  3. #3
    Join Date
    Nov 2000
    Posts
    245

    1. prompt the sid
    2. add checking logic based on sid, verify any *sid* file exist under $OH/dbs, if yes, reconfirm before continue....

  4. #4
    Join Date
    Oct 2000
    Posts
    449
    Thanks TamilS:
    We create the Environment of all dbadmin files (entire directory from bdump, cdump, udump, pfile, log, create etrc.,) and establish/have a link under OH/dbs/init<sid>.ora ..
    This link will exist even before we run createdb.sh and so how to check still remains.. How does the script know if the db is still there.. or not? Do I make sense?

    And Jeff:
    There is now way of hiding the file since the QA has to test every possibility and they want to run this intentionally to avoid any outcomes.. Are you kind of suggesting that once the script is run and db is successfully created change the permissions so it cannot be executed and be moved to a different folder?

    Thanks.

  5. #5
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    Check for oratab entry for dbname string or get it from 'ps -ef|grep pmon' (which gives all instances currently running)and take dbname/instance name string.

    Iam assuming your instance name=database name too.

  6. #6
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092

    Yes, once the createdb script has successfully run, either change the permissions on the file or move it to another directory so somebody doesn't "accidently" run it.
    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width