June 10, 2011 at 5:25 pm
I have a master script that contains all the object in an existing database all scripted out to be run and create those objects, but when I run it I receive all kinds of failure messages. Things like...
//**** Failed To Add STIUser Schema ****//
Cannot find the user 'STIUser', because it does not exist or you do not have permission
Can anyone please advice me on the order in which I should be running scripts to create specific objects (i.e. tables, stored procedures, schemas, users, roles, etc...)?
My thoughts are that they should be run in the order something like this:
users
schemas
tables
stored procedures
etc...
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
June 10, 2011 at 6:22 pm
You definitely need logins and users early, perhaps roles as well. I think you have a good list there.
Here are some things I learned awhile back. I didn't have users or schemas in there, but this should help with other objects: http://www.sqlservercentral.com/articles/System+Development+Life+Cycle/vcspart3/525/
Note that my company, Red Gate Software, sells a couple tools that can help. They build a dependency tree and ensure that objects are created in the proper order. If might be worth the $$ to you to grab one copy, run it against your master db, save off the script for use by your app.
June 11, 2011 at 4:56 am
In addition to the order, you also have to worry about permissions. Do you have permissions to create the objects? Once created, do the objects have permissions to see other objects?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 15, 2011 at 12:14 pm
Thanks for all the input!
A clever person solves a problem. A wise person avoids it. ~ Einstein
select cast (0x5365616E204465596F756E67 as varchar(128))
June 20, 2011 at 1:28 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply