I'm trying to reverse engineer my database via the SQL Server Wizard in the VS2010 database project template. I'm able to RE my database, but it's not enough, because in order for my sprocs to compile without errors and warnings, I need to have my linked servers and their logins included also. However, my DBA's can't give me the required VIEW ALL DEFINITION permission on the SQL Server in order to run that wizard at the server level. They don't want to do that for me in VS2010 so I am stuck. Has anyone had success compiling or found a work around for using the database level database project and using linked servers and other server level objects?
Developers can create an empty server project. You can then have your DBAs populate it via "Import Database Scripts and Objects" command. Just have them right-click the server project and they'll see that as the top command.
Your database project then should add a reference to this server project, and you should be all set.
Microsoft designed database projects on the assumption that only a DBA will import objects. For instance, in importing a SQL Server 2008 database, if you don't have "VIEW DEFINITIONS" privilege, you'll get an error about attempting to import user encryption keys. You'll get this error even if there are no user encryption keys! They assume only a DBA will do that.
Read and vote on Schema Compare permission error for Database Encryption Keys even though the type is set to be ignored if you would like to let Microsoft know what you think about this issue.
Related
I have been using Microsoft SQL Server 2017 for a while (just DDL and DML) and recently decided to install JetBrains DataGrip because I thought it was another DBMS but with dark theme.
When I try to create a new database it tells me to assign a host/user/password/port and I cannot do anything because it can't "connect to the database". I've been using Microsoft SQL Server Management Studio 2017 and never needed to assign a port/password/host or anything? I just created a new database and started adding/filling tables. How does JetBrains DataGrip work?
I noticed that on the JetBrains DataGrip page it doesn't say it's a DBMS, it says it's a "Database IDE". I cannot seem to find information about this on the web.
When considering a RDBMS such as SQL Server, the core component is a service/engine which acts as an interface between the database (files) and end users or applications allowing database functions to be carried out.
SSMS (SQL Server Management Studio) is just one of many possible end users of the SQL Server Database, and happens to have be part of the SQL Server software suite. It should not, however, be confused with the database itself as SQL Server operates perfectly happily without ever seeing SSMS.
Any form of user interface tool for a database needs to know how to connect to the database it is going to manage. In your case you most likely installed the entire software suite with default settings and as such didn't need to know what they were. JetBrains DataGrip however does need these settings.
You can find out what your specific settings are by running the SQL Server Configuration Manager.
JetBrains DataGrip is just a Database IDE to connect to different database engines via only one environment without needing to install management tools for every database that you want to work with.
I am having problems publishing a SSDT database project and registering it as a data tier application. Let me explain.
I have a database (A) which references two other databases (B & C) through linked servers. I have created projects based on B and C and snapshoted the projects to create dacpac's for databases B and C. I have created a database project for database A which has database references to B and C through dacpac's. I have set SQLCMD variables and modified the db project ddl scripts to use the SQLCMD variables in place of the un-resolved linked server names. The project builds!
I am trying to publish the project as a data tier application but keep receiving the following error "Databases registered as a DAC database must be hosted by an instance of SQL 2005 SP4, SQL 2008 SP2, SQL 2008 R2, SQL 2012 or SQL Azure". Incidentally I am running SQL server 2012.
I thought I would test whether I could register as a data tier application through SSMS. Within SSMS the option to "Register as data Tier Application" is grayed out. I therefore tried to "Export Data Tier Application" and received a number of error in reference to the linked server objects.
My question is; is it possible to deploy a SSDT database project and register it as a Data Tier Application where the project is using linked servers, or am I doing something wrong? If it is possible could some one provide some advice.
I have broken Google looking for the answer, so any help would be greatly appreciated...
I had this error recently so I'll add my solution for anyone else who comes across this, already added to the dba stack exchange
Turns out in my publish.xml I had RegisterDataTierApplication set to True. The first time I published the database it worked fine, but then I got the same error, as the database was already registered as a Data Tier application.
By setting to false (or unchecking the checkbox in the gui) it works fine.
I am unable to use my database project after migrating from VS2010 to 2012.
All scripts for the database objects in the project are connected to the automatically-created localdb database. I am not interested in localdb since the database is large and I maintain it in a full-blown instance of SQL Server 2008 R2.
I tried all possible settings in Tools-Options-Database Tools-Data Connections-SQL Server Instance name to no avail. After re-loading the projects, it always restores the same connection to localdb.
My problem is that I need to refer from one database to another. I do it with synonyms:
CREATE SYNONYM [pcg].[practice] FOR [PcgDb].[Portal].[practice];
This script is automatically linked to localdb and the PcgDb on localdb has no tables. Hence I an getting an unresolved reference error 71501.
I tried also all combinations in Add Database Reference, even added my instance of SQL Server to the localdb linked servers, still the same error.
When you first create the SSDT project, the first step should be importing the target database; at that time you can specify you live instance of SQL Server. You shouldn't need to "get rid of" the local DB, it should just be ignored at that point. Perhaps this is happening since you migrated an existing 2010 project? In that case I would suggest you just create a new Project and do the import from the live server.
How can I use SQLServer (instead of SQL Express) as my database?
I'm trying to go thru the ContactManager tutorial, but I can't seem to get it to use SQLServer - when I pick SQLServer from the "Add New Item" dialog, I get an error telling me that SQL Express isn't installed.
I know I must be missing something basic...
Most tutorials on the ASP.NET site are written in such a way, that you don't have to buy any software to do them. They use Visual Studio Express and SQL Express in their examples.
However, You can still follow along with the tutorial. Just make a few adjustments. Go to the Server Explorer to create a Connection to your SQL Server, and create the database and tables.
Then when it comes to the step of creating the EntityDataModel, create a new connection to the database you just created.
Only SQL Express can attach your database at runtime. If you have a non express version of SQL Server you will need to create the SQL Server using SSMS. If you want the file to physically live in app_data then when asked where to put the database file and the ldf indicate the app_data folder. Once you have created it, it is easy enough to simply add it as an exsisting item, although it can't be checked into source safe without creating obvious issues. I hope this helps.
If you're using a full-fledged instance of SQL Server, you don't need to use the "Add New Item" dialog at all. Rather, connect to your SQL Server instance (via Visual Studio or SQL Server Management Studio), and create the new database there.
I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?
EDIT: I have very limited access to my server so I don't think I can access the backup file that I could create so that is out.
If the database is not too big, you could use the Database Publishing Wizard.
This is a free tool from Microsoft which creates a complete SQL script of a database for you (not only the tables and stuff, but all data as well).
You can install the tool on your machine, connect to a remote server and let the tool create the script directly on your machine.
You can download the Database Publishing Wizard here.
Apparently the link above doesn't work anymore in 2019.
That's probably because in newer versions of SQL Server Management Studio, the functionality of the Database Publishing Wizard is included out-of-the-box, so there's no need to install it separately.
It's now called the Generate and Publish Scripts Wizard, but it does exactly the same.
You can right click the database -> Tasks -> Generate scripts. Here you can select one, multiple, or all objects. Then in the 'Set Scripting Options' step of the wizard, click Advanced. In here set the property 'Types of Data to script; to Schema and Data.
Having done these steps, make sure you publish to a file. Because only file can handle large amounts of data.
Now you should have all your objects, tables, and data scripted. Now start running the scripts and viola!
Back up the database on the server and then restore it locally in SQL Express.
EDIT: If this is part of your work, surely you can get someone in networks to get you a backup..?
If you can login to both servers (the Express and the 05 Server) using SQL Server Management Studio then you can do a DB Restore from one database to the other. No need for backup files at all.
You can use SSIS's database copy wizard, but it's not quick at all. Is there a DBA there that you can ask for the backup file? That will probably turn out to be the fastest way.
Depending which versions of SQL Server you are using, you might get some mileage out of the SQL Server Database Publishing Wizard from Microsoft. I've had mixed results with this tool in complex environments, but for most simple database scenarios it is a great tool.
An example of a scenario where I ran into difficulties was a DB with multiple distinct schemas, each with their own owner and extreme separation between the tables (don't ask...). As I said, though, most other scenarios have been fine.
Save your database as a sql script
EMS SQL Manager (for example) allows you to backup your database as a script in a .sql file. It is then possible to run this file against any other SQL server. Just update the first line of the script (CREATE DATABASE ....).
You can even fully parameter the script in order to include data from complete or filtered tables.