Solved

SQL 2008 create new Database

Posted on 2011-02-28
7
378 Views
Last Modified: 2012-05-11
Hello experts,

I have a SQL server with SAN attached storage and allocated letter D:\Data and L:\Log and set them in the default DB settings after installing SQL 2008.

When running script to create new DB, mdf and ldf files are never created inside Data and Log folders instead they are created in the roor of D and L, I have checked the permissions.

Please advise, what is stopping from creating mdf and ldf inside the sub-folders?

Thanks and Regards.
0
Comment
Question by:goprasad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35004479
try the following script:-

CREATE DATABASE [NewData] ON  PRIMARY 
( NAME = N'NewData', FILENAME = N'D:\Data\NewData.mdf\NewData.mdf' , SIZE = 2048KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'NewData_log', FILENAME = N'L:\Data\NewData.ldf\NewData_log.ldf' , SIZE = 6144KB , FILEGROWTH = 10%)
GO

Open in new window

0
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35004490
corrected:-

CREATE DATABASE [NewData] ON  PRIMARY 
( NAME = N'NewData', FILENAME = N'D:\Data\NewData.mdf' , SIZE = 2048KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'NewData_log', FILENAME = N'L:\Log\NewData_log.ldf' , SIZE = 6144KB , FILEGROWTH = 10%)
GO

Open in new window

0
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35004500
you may ignore the default values of size and filegrowth:-

CREATE DATABASE [NewData] ON  PRIMARY 
( NAME = N'NewData', FILENAME = N'D:\Data\NewData.mdf' )
 LOG ON 
( NAME = N'NewData_log', FILENAME = N'L:\Log\NewData_log.ldf' )
GO

Open in new window


but the folders Data and Log must be created in drives D: and L: respectively before executing this script.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 2

Expert Comment

by:Umesh_Madap
ID: 35006133
CREATE DATABASE [TEST_DB] ON  PRIMARY
( NAME = N'TEST_DB', FILENAME = N'D:\Data\TEST_DB.mdf' , SIZE = 3072KB , FILEGROWTH = 1024KB )
 LOG ON
( NAME = N'TEST_DB_log', FILENAME = N'L:\Log\TEST_DB_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO

use can use the above script and also u can set the initial size of the database and file growth these two parameters you can set as per your requirements.

please let me know if yo need any further clarification.
0
 

Author Comment

by:goprasad
ID: 35023976
This is the new SQL box I built with sql2005 and in database settings for the instance, I have allocated D: and L: for data and log respectively, so that when I create a new DB, the mdf and ldf should go and sit by default in D and L. But this is not the case, for ex: when I execute the command below, the mdf/ldf are located in C:\
Use master
go
create database test32
go

I have attached screenshots for reference. Want to know why the default location for mdf and ldf are not used.

Please advise. Drives Drives Data
0
 

Accepted Solution

by:
goprasad earned 0 total points
ID: 35024075
I figured it out, when you make a changes in Database settings, sql server needs a restart. When I then executed the same command to create new DB, it did use def locations for mdf and ldf
0
 

Author Closing Comment

by:goprasad
ID: 35067717
When i restarted the sql server after having made the changes in DB settings, got the desired result.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question