Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Create database script with permissions and size

Author  Topic 

mruprai
Starting Member

12 Posts

Posted - 2015-01-23 : 07:19:49
Hi,

We have a server which we manage and each time we want to create a database(no tables or views etc) with permissions and database size repetitively.

What is the best way to do this?
here is what I thought
-Manually create a database with what we want, add users and then generate script
-find a script and manually edit it?
-Copy and paste a existing script someone can provide?
-someone mentioned template? whats this?

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2015-01-23 : 11:32:05
I don't know if there is a definitive "best" way to do this. The approaches you list are all good but here are a couple more:

Make your initial database and security; Backup it up; Restore (and rename) to targets as needed. (You may need to sync the database Users to the Logins afterwards)

or

If this is all on one server, modify the Model database



No amount of belief makes something a fact. -James Randi
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2015-01-26 : 01:31:20
@mruprai - Your first option of create database , add permissions and script is a good one. To extend the idea - you could have the template database on the sql server , and as part of the build process , copy the database .

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -