DW create User for DB Owner

  • we have created Data warehouse server and planning to create Databases, Schema and users.

    If i create any Database that will go under my name but i would like to create Any database under specifice user so how can i do it?

    Should i create sql server user/login or create AD login and create user under then create the Database so it will show as Database under that user not under my name?

    What's the best practice?

    I have to create also Schema for Data warehouse databases so any useful additional information will greatly helpful.

  • You can change the owner of databases or schemas using alter authorization. For Example:

    --change database owner
    ALTER AUTHORIZATION ON DATABASE::YourDatabaseName TO sa;

    --change schema owner
    ALTER AUTHORIZATION ON SCHEMA::YourSchemaName TO dbo;

    Sue

  • Thanks Sue.

    I know that as i have done couple of times but my question is when we have built the servers new and have to create the new databases and would like to create new DB under specific user not under my user login as when i login to the server it will use my windows authentication so as a Db owner it will show my name so what's the best way i can handle it?

  • When you create your database as part of your create script you simply change the authorization afterwards, so it'll look something like Create Database

    […]

    Once your objects are created you can change the authorization to whichever user you want, as an alternative you can Always login as that user and if permissions allow, run your create script as that user OR you could use EXECUTE AS to run a script as specific user, this requires your account to have impersonation permissions.

  • Got it!

    What do you prefer more AD account or sql user DB Owner?

    Thank you!

  • I'm planning to create like below but What will be the ideal DB script should be for Data Warehouse?

    USE master;

    GO

    CREATE DATABASE ETLDB

    ON

    PRIMARY

    (NAME = ETLDB_Dat1,

    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\ETLDB_dat1.mdf',

    SIZE = 100MB,

    MAXSIZE = 200,

    FILEGROWTH = 20),

    ( NAME = ETLDB_dat2,

    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\ETLDB_dat2.ndf',

    SIZE = 100MB,

    MAXSIZE = 200,

    FILEGROWTH = 20),

    ( NAME = ETLDB_dat3,

    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\ETLDB_dat3.ndf',

    SIZE = 100MB,

    MAXSIZE = 200,

    FILEGROWTH = 20)

    LOG ON

    (NAME = ETLDB_log1,

    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\ETLDB_log1.ldf',

    SIZE = 100MB,

    MAXSIZE = 200,

    FILEGROWTH = 20),

    (NAME = ETLDB_log2,

    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\ETLDB_log2.ldf',

    SIZE = 100MB,

    MAXSIZE = 200,

    FILEGROWTH = 20) ;

    GO

     

  • No one can tell you what the ideal would be - it really depends on your environment, your data warehouse, etc.

    The files seem pretty small with a small growth increment. A lot of small growths could be a performance hit. But the thing I was wondering is why do you have two log files?

    Sue

  • Thanks Sue.

    What should be the ideal files and File size for small Sql Data Warehousing?

  • No one can tell you ideal size for database files just by asking what they should be. You would want to do some capacity planning to determine things like that. Do a search on capacity planning for SQL Server.

    Sue

  • Thanks everyone!

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply