May 20, 2008 at 3:33 am
Hello,
I am writing a script which must be able to create a database, add tables to that database, add stored procedures.
you can find the script attached
But The first time I run this script it gives me these errors.
Msg 2760, Level 16, State 1, Line 6
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure fix, Line 5
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure SHOW_NONCRITICAL_FAILED_JOBS, Line 11
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure SHOW_CRITICAL_FAILED_JOBS, Line 11
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure NAGIOSINPUT, Line 6
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_DATABASE_EXISTS, Line 14
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Line 3
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure show_login_errors, Line 15
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_DATA_SIZE, Line 64
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_FAILED_LOGINS, Line 48
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_NONCRITICAL_FAILED_JOBS, Line 33
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_CRITICAL_FAILED_JOBS, Line 57
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_LAST_BACKUP, Line 47
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_DATABASE_STATUS, Line 53
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_WEAK_PASSWORDS, Line 102
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_USER, Line 3
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_UPTIME, Line 29
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_LOG_SIZE, Line 51
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_DATABASE_STATUS2, Line 54
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure CHECK_CONNECTIONS, Line 39
The specified schema name "nagios" either does not exist or you do not have permission to use it.
Msg 3902, Level 16, State 1, Line 51
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
when I run the script for the second time. No problemo.
I believe
The first run it creates the db and the schema etc. But it is not yet recognised by the end part of the script.(the part of adding tables, stored procedures etc. etc to that db)
How can I fix this so I only have to run this one time?
Thanks.
May 20, 2008 at 3:39 am
Looks like the first time you run the SQL, the database context is unknown but the second time, the context is the user database.
Move the "Use [nagios]" statement before you create the users/schema.
SQL = Scarcely Qualifies as a Language
May 20, 2008 at 3:50 am
Carl Federl (5/20/2008)
Looks like the first time you run the SQL, the database context is unknown but the second time, the context is the user database.Move the "Use [nagios]" statement before you create the users/schema.
==> this puts all the stored procedures and tables in the master database. and doesn't create the nagios db.
May 20, 2008 at 6:33 am
Hi Steve,
Put the use database statement mentioned above directly after the create database. This will ensure any statements after the use database statement will be aimed at the correct database.
Matt.
May 21, 2008 at 5:19 am
thanks.
I fixed it thanks to you guys
May 21, 2008 at 5:51 am
Nice to hear!
Thanks,
Matt.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply