Re: AdventureWorks scripts

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Jason,

Regarding permissions you should verify that the user you're looking into has at least CREATE DATABASE permissions, but for you're purposes you'll probably have CONTROL SERVER which includes the other. You can do this in SSMS as follows:

1. Expand the Security node.
2. Expand the Logins node.
3. Assuming you're using Windows Security (default for Express) right click on the name of your Windows account and open Properties.
4. Verify that the Login is a member of the SysAdmin Server Role.
5. If you are not a member of SysAdmin, check your specific permissions at the Server level to see if you have CREATE DATABASE, which you can do from the Securables page of the Property dialog by clicking Search and following the path from there.

If you cannot see your account, or you you get permission errors when you attempt the steps above, then you likely don't have the appropriate permissions to create a database (running the scripts will fail as well if this is the case). You will need to determine what user is a member of the SysAdmin role and login as that user to give yourself appropriate permissions. If you're working with SQL Server 2008, you would have configured this during installation of SQL Server and it is likely the same user as the person who did the installation. If you're working with SQL Server 2005, it's likely any member of the Windows Administrators group.

If you have the appropriate permissions, then John is likely on the correct path and you should continue down that path to a resolution.

--
Regards,
Mike Wachal
Program Manager
This posting is provided "AS IS" with no warranties, and confers no rights

"John Bell" <jbellnewsposts@xxxxxxxxxxx> wrote in message news:0475E10B-6FF9-4EE2-996B-64C9F376F5E6@xxxxxxxxxxxxxxxx
Hi

As you are restoring to a SQLExpress instance you probably need to use the the MOVE option as
the directory "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" probably doesn't exist but
"C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA" will exist. For the RESTORE command see http://msdn.microsoft.com/en-us/library/ms186858.aspx for SSMS see information about the options tab http://msdn.microsoft.com/en-us/library/ms188223.aspx

Judging by the directory name this backup is not a SQL Server 2008 version of the database, so you may want to download the adventureworks databases again and re-install them using the installation process. http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=18407

John



"Me!" <dummy@xxxxxxxxxxx> wrote in message news:O%23GGQktBKHA.3368@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, I'd rather attach the db, but I have the following problems:

I have a back-up that I've been trying to restore but When I restore it, I can restore from device, select the file, and see the contents. But after selecting 'restore' I get the following error msg :
------------------------------
Restore failed for Server 'MACBOOKPRO\SQLEXPRESS'. (Microsoft.SqlServer.SmoExtended)
------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf'. (Microsoft.SqlServer.Smo)

Which appears to be permissions related, so when I right click on the shortcut to SQL Server Management Studio and can choose Run As Administrator and try again I get the following error:

CREATE DATABASE permission denied in database 'master'.
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 262)

I told you I wasn't a DBA ! (and now my other sample DBs - northwind, pubs etc. aren't visible), error msg is:-

The server principal "MACBOOKPRO\Administrator" is not able to access the database "Northwind" under the current security context. (Microsoft SQL Server, Error: 916)

Any ideas?

I'm not a DBA as such, just an analyst who queries the data, so a lot of this 'back-ground' SSMS stuff I've no idea about :-)

Many thanks,

Jason

"Gail Erickson [MS]" <gaile@xxxxxxxxxxxxxxxxxxxx> wrote in message news:eShs0YmBKHA.4984@xxxxxxxxxxxxxxxxxxxxxxx
You can find the installation script and data files (csv) here: http://msftdbprodsamples.codeplex.com/SourceControl/changeset/view/27902
Once you've downloaded all the files, you'll need to modify the instawdb.sql script to point the BULK INSERT statements to the correct location of the csv files.

Frankly, attaching the database files is much easier. If you can tell us what problems you're having, we can probably help you.

--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of SQL Server 2005 Books Online from http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
Download the latest version of SQL Server 2008 Books Online from http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx

"Jason" <ThisisaDummyEmailAddress@xxxxxxxxxxxx> wrote in message news:h3o8tu$44o$1@xxxxxxxxxxx
Can anyone advise me where I can find the create/insert scripts for AdventureWorks. I'm habving problems with installing a .msi and attaching to the mdf, but know the scripts will be ok but I can't find them.

many thanks, Jason





.



Relevant Pages

  • ADP, Application Role, and objects
    ... The above link is to an atricle on how to implement SQL Server Application ... After you connect with your ADP, fire a bit of code to set the ... third party tools to view the data on the same database. ... Scenario 1 - If I explicitly grant permissions on that object to the user ...
    (microsoft.public.access.adp.sqlserver)
  • RE: WSS install locked into MSDE DB - Can not install for SQL Serv
    ... For the MASTER database ... Althought we change the Configuration Application pool several times ... interface BUT they appear to be MSDE databases and not SQL Server databases. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: How to Replicate an SQL Server 2000 Database
    ... actual server name) enterprise manager should associate the database with the ... Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.replication)
  • Re: SQL 2005 Best Practice vs SQL 2000: Application Files Separate from data (and log) files
    ... I have had quite a number of clients that used a SAN for a database server and suffered significant performance problems because their underlying SAN infrastructure was a huge stripe across many drives. ... By application files I mean the binn folder which contains the sql server executable among other things. ...
    (microsoft.public.sqlserver.setup)
  • Re: Where can I find my detached database
    ... The data file should be in your SQL Server Data folder. ... No chance SSMS to drop a database when you detach it. ...
    (microsoft.public.sqlserver.server)