SQL 2012 :: Tables Removed From Diagram After Database Restore

Jun 9, 2015

In last week my database was crashed and some how i managed to restore it back on SQL2K12 but after restoration all the relationships are removed and sql server is showing below message when i open diagram of the database.Table(s) were removed from the diagram because privileges were removed to these table(s) or the table(s) were dropped.how to get back all the relationships of the tables.

View 2 Replies


ADVERTISEMENT

SQL 2012 :: Find When Database Was Last Removed From AlwaysOn Listener?

Feb 25, 2014

How to find when (date/time) a database was last removed from AlwaysOn Listener?

Is there any query (DMV) to find the details easily?

View 1 Replies View Related

SQL 2012 :: Queries Based On ER Diagram And Joining Tables

Feb 22, 2015

I need to create a few select queries based on an er diagram.

These are my Create Table statements and import statements:

Create Table Agent (Aid integer primary key, Pid integer, aName text);
Create Table Product (Pid integer primary key, pName text);
Create Table Supplier (Sid integer primary key, sName text);
Create table Supplies (Sid integer, Pid integer, price decimal(8,2));

.import agent.txt Agent
.import product.txt Product
.import supplier.txt Supplier
.import supplies.txt Supplies

I think I got all my create table statements are correct.

I need to Find the number of agents for each supplier that has at least one agent. The result should be tuples of the form (sid, sName, number of agents)

-Select Sid, sName, count(Aid) from Agent A join Supplier S on (S.Sid = A.Sid) group by S.Sid, S.sName, Aid;
But it gives me this error: no such column: A.Sid

Im thinking I might have a problem with my create table statement and/or primary key statements?

View 9 Replies View Related

SQL Security :: Data Masking Removed After Joining With Other Tables In CTP 2.1?

Jul 6, 2015

I find that dynamic masking does not work on joining tables in SQL Server 2016 CTP2.1.

For examples, I create the following table:

CREATE TABLE [dbo].[HRM_StaffAppointment](
[StaffID] [nvarchar](11) NOT NULL,
[ApptSeqNo] [smallint] NOT NULL,
[ReportingDept] [nvarchar](10) NULL,

[Code] ...

Then I apply mask on StaffID and RankDesc.

alter [dbo].[HRM_StaffAppointment] alter column [StaffID] add masked with (function='default()')
alter [dbo].[HRM_StaffAppointment] alter column [RankDesc]
add masked with (function='default()')

When User A logged in and query on HRM_StaffAppointment, StaffID and RankDesc are perfectly masked. But User A can remove the masking using another table:

CREATE TABLE [dbo].[staffID](
[staffID] [nvarchar](255) 
) ON [PRIMARY]
select a.*
from dbo.HRM_StaffAppointment as a
left join dbo.staffID as b
on a.StaffID = b.StaffID

It looks like a security hole to me, or I'm doing anything wrong?

View 4 Replies View Related

SQL 2012 :: SSIS Connection Initial-catalog Removed When Adding Expression To Set It Dynamically?

Feb 14, 2014

SQL 2012 SSIS package.I have a package connection that has the initialcatalog set in the connection string/properties page. This package connection also has an expression defined to set the initial catalog at runtime according to a passed in parameter. It works fine.

I am trying to create a second package in this same manner, but the connection does not seem to want to keep both the hardcoded initialcatalog and the expression to set it dynamically.

I can hardcode the initcatalog just fine, when when I add the expression to set it dynamically later, it clears out the initialcatalog I added.

What am I missing, why was I able to do this in the other package? I compared as much as I can think of between the two packages, all seems similar.

View 1 Replies View Related

How To Backup CE Database Tables And Restore To Newer Database?

Jul 3, 2007

I am fairly new to VS 2005 and SQL Server CE. I have developed a Desktop Windows application using VB 2005 and the SQL Compact Edition Database. This application will sell to users via web download.

When they download a service patch, or updated version, I wish for them to retain the data in their present database. In other words, fill the new database with the old data. The new table structures will remain intact except for added columns at the end.

Question is how to save the old data and update the new database with it. Is there an easy way to do this, or do I need to write a module to save a database copy, and update the new database with content at install time?

View 6 Replies View Related

SQL 2012 :: Restore Database If It Is Offline

May 29, 2015

1.can we restore the db if it is offline?
2.restore information stores in table 'msdb..restorehistory' if we restore the db when the db is offline?

View 1 Replies View Related

SQL 2012 :: Script To Restore Database

Jun 24, 2015

I am on SQL 2012 standard version and I am writing a script to restore database from .bak files on a network.

ALTER DATABASE DB1
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE

----Restore Database
RESTORE DATABASE DB1
FROM DISK = 'N:SQLBackupDailyDB1_backup_2015_06_22_194002_0500494.bak'
WITH REPLACE
ALTER DATABASE db1 SET MULTI_USER
GO

Since I have to restore about 100 databases , I am planning to put the script in a cursor. However my problem is how can I get the bak file name dynamically .

View 1 Replies View Related

SQL 2012 :: Restore Master Database For A New Database?

Jul 29, 2014

Sometime during the night last night some user account permissions were "lost". Am I right to think that restoring the master database would be the way to go? We have a 2 node 2012 cluster and I stop the cluster resource and start the db in single user mode from the active node. Somehow the sharepoint farm is still trying to connect so I can't get logged in single user. What method could I use to stop users from connecting when I don't have access to the sharepoint farm.

View 8 Replies View Related

SQL 2012 :: Backup / Restore And Copying A Database

Mar 27, 2014

I'm working on a project where I need to build a small database and then copy it to a server at the client's site. I can't connect directly, so I have to use a VPN connection and use Remote Desktop, copy the database backup from my machine to the cloud, then download it to the client machine. The project is still in the early stages, and the client is still sending me data in CSV files and Excel spreadsheets. I'm periodically needing to do a complete refresh of the database at the client. I've hacked my way through it a couple of times, but I need to know the proper way to do it. I get errors on the restore step, telling me the file is in use.

View 8 Replies View Related

SQL 2012 :: Restore 2 Database Simultaneously In Same Instance?

Apr 10, 2014

Is it possible to restore two databases simultaneously in same sql instance?

View 3 Replies View Related

SQL 2012 :: When To Restore And Rebuild Master Database

May 11, 2014

If one is regularly taking backups of system databases, when does it become necessary to rebuild the master database. I am looking for a situation where rebuilding the master is preferred to restoring it from backup.

View 1 Replies View Related

SQL 2012 :: Database Backup And Restore On Same Server

Jun 19, 2014

I am having issues with Restoring the Backup of same Database on to the same server , as i know like many of you will be asking y i need to restore on same server.. Well the need came in that way , now i think i know the problem (i.e) The Orginla DB is there and also i am restoring the same DB again on that server, so .mdf and .ldf will be same .

View 8 Replies View Related

SQL 2012 :: Restore Specific Columns From A Database

Dec 15, 2014

I have an SQL .bak file and I would only like to restore specific columns as one of the columns is a free text field and is substantially increasing the size of the file. I can't restore it due to disk space constraints so dropping the column isn't possible if I can't get the table into a database locally.

View 1 Replies View Related

SQL 2012 :: BackUp / Restore Options For Particular Database

Jul 7, 2015

I'm using SQL Server 2012 R2 and am working on configuring vendor access to a particular DB. I have a test db & (what will eventually be) the production DB. I've configured security for the test DB and want to back that up, then restore it (including all settings) to the prod one, renaming it to the prod DB name.

View 3 Replies View Related

SQL 2012 :: Piecemeal Restore With Filestream Database?

Sep 9, 2015

We have one database with Filestream enabled. There is one table "dbo.files" which uses Filestream.

We created a filestream filegroup Filegroup1 and added 3 data containers to it. (3 filestream data containers within the same filegroup.)

We have three LUNs F:, G:, H: each with a capacity of 2TB (That is the limitation). F: and G: are almost full. So, I restricted their growth so inserts do not happen into these data containers. Inserts are now going into H: drive which has lots of free space. Our application code prevents any sort of deletes or updates to this table. So data in the growth restricted containers will never change.

Now the database is around 6 TB in size and backups is a challenge. We are contemplating on migrating storage to netAPP and use their snapmanager console which is much faster.

However, until then, we need a solution with native SQL backups. We tried partial backups and piecemeal restore.

WE tried this on a test server :

1) Partial backup only the read-only data containers first, (F: and G:) (The plan is to back these up just once a month as this data never changes).

2) Partial backup the primary filegroup plus the third data container in the Filestream filegroup which is subject to inserts (H:)

While restoring, we tried the online restore, First, I restored the backup obtained from step 2 above with recovery option. Then I restored the backup obtained from step 1 with recovery. I see that the database was brought online. However, when I try to query the dbo.files table, I get an error stating that some files of the filestream filegroup are offline.

View 0 Replies View Related

Is It Possible To Just Restore Particular Tables From A Back Up Of A Database

Jan 29, 2007

Hi,
  I backed my sql server database on Fri at 3:15pm and then tried importing some tables individually from a different database and but that didnt work out too good, so is there a way i can just restore particular tables from the backup.
any help will be appreciated.
regards,
Karen

View 4 Replies View Related

SQL 2012 :: Restore Database Command - BufferCount Option?

Jul 22, 2014

What the BUFFERCOUNT option does in a RESTORE DATABASE command?

View 5 Replies View Related

SQL Server 2012 :: Restore Database By Stored Procedure

Jul 26, 2014

I need to create a procedure with Restore Database command in many applications in differente platforms. But I can't "use master". How do I do it?

View 1 Replies View Related

SQL 2012 :: Database Backup And Restore Across Different Authentication Models

Oct 22, 2014

We have a bunch of SQL 2012 databases which use SQl Server authentication (essentially local dev instances). Is it possible to take a backup of one of these database and then push them onto a (central) server which uses Integrated security (based on active directory authentication) using a script to change and map the authentication model in the process?

View 1 Replies View Related

SQL 2012 :: Getting Multiple Database Batch Restore Script?

Feb 6, 2015

I have backed up databases from a 2008 server and now I would need to restore them to a 2012 , the only issue is that I need a script bcuz I have over a hundred databases.

View 9 Replies View Related

SQL Server 2012 :: Restore Database With Minimal Downtime

Oct 12, 2015

I have a process that restores a production DB, overwriting the existing copy each night. I'd like to keep the solution "up" for as long as possible. And this'll be more important if I want to update it in the day (where there are more queries) too. The nature of queries thrown at the system is that there are about 20 per hour, it's underpinning a reporting system, it's not an OLTP system.

It seems to me I could restore the fresh DB copy into a holding DB, then rename it to the production DB name at the end of the process. The rename process should be pretty much instant.

But I need to think about detecting and waiting for queries to complete on the prod DB, before removing/demoting it (actually, I though to rename it, then reusing it as the next copy to update).

View 5 Replies View Related

How To Recover SQL Database From A Removed Laptop Hard Drive?

Jul 23, 2005

Dear group:I have removed my hard drive from my laptop (which is now toast) andhave managed to recover nearly all the data from it by installing thedrive into my desktop. I was hoping to reboot the dektop to see if Icould load the operating system on the laptop's hard drive so I coulddo a manual backup of the SQL database on it. This does not work.Does anyone know of a way to recover my SQL database and all its tablesgiven the circumstances above?TIAISZ

View 5 Replies View Related

SQL Server 2012 :: Restore Database And Create Users Using Minimal Elevated Privilege

Apr 29, 2015

What I want to do is :

- restore a backup of a 3rd party database onto one of our servers
- this has no users that I can use
- there is some ETL processing so we're using Control-M to manage the process
- create a database user and grant it db_reader.

I'd like to do this without granting any users elevated privileges if possible.

What I've done so far is grant the Control-M user (this is a domain user) dbcreator rights and made it owner of our copy of the database that is being refreshed.

The refresh is completing, but Control-M is not able to log onto the database to create the user.

What is the best way to accomplish this task without granting the control-m user sysadmin rights?

Would I be able to do it if I used a SQL Agent job for the restore and user creation?

View 1 Replies View Related

Relations Between Tables - Contraints Diagram

May 4, 2004

Hi all,
I have a big problem. I have many tables with constraints, with foreign keys. I need to create a ordered list of tables, on the top must be the basic table what has no parents, then the second level tables (those depends on the first level) the the names of third level etc.

for example:
Table A[id]
Table B[id, idc]
Table C[id, ida]
Table D[id, ida]
Table E[id, idc]

I tried it by using information_scheme but I was unsuccesfull.

The result should be:
A
C
D
B
E

Thank you,
Tom.

View 2 Replies View Related

Tables Information Within Diagram SQL 2000

Apr 16, 2007

Hi,

I am trying to retrieve tables name for a database diagram within SQL database 2000 using T-SQL .I did some search Found that using dtproperties table I can get the diagrams name. but there is no information about the tables within these diagrams.

I wonder if there is any one can help on that

Regards
Tamer

View 3 Replies View Related

Tables Information Within Diagram SQL 2000

Apr 16, 2007

Hi all,

I am trying to retrieve tables name for a database diagram within SQL database 2000 using T-SQL .I did some search Found that using dtproperties table I can get the diagrams name. but there is no information about the tables within these diagrams.

I wonder if there is any one can help on that

Regards
Tamer

View 1 Replies View Related

SQL Server 2012 :: Create Table On Given Data Model Diagram

Jul 27, 2015

I never created table on the basis of Data model diagram . I have to create the 3 table on the basis of given Data model diagram. There are 3 tables

1.md_geographyleveltype
2.md_geographylevel
3.md_geographylevelxref

I have tried to create 2 table but unable to create 3rd table. Need to review the script of first 2 table and to create table script for 3rd table.

View 5 Replies View Related

SQL Tools :: How To Print Huge Diagram Of Many Tables In SSMS

Nov 19, 2015

I have many tables, and I just want to print the relationships between them.  The ones without foreign keys to primary key relations are irrelevant.  I made a diagram of all tables in sql server management studio, and it shows the key relations, but its a very large diagram horizontally and vertically.  Is there a way to print the whole thing so that it doesn't take endless pages that I don't know how to piece together?

View 3 Replies View Related

Not Able To Create A DB Diagram In SQL Server 2005. No Menu Option For Creating A DB Diagram??

Apr 23, 2007

I have created a database with several tables. I want to create a database diagram to show the relationshipbetween the tables. Below are the steps from the SQL Server 2005 documentation on how to create a database diagram. The problem is that when I right click on the Database Diagrams folder I am only given two options. They are:"Working with SQL Server diagrams" and "Refresh"There is no menu choice to create a new database diagram. Can anyone tell me what the problem here is?
 
To create a new database diagramIn Object Explorer, right-click the Database Diagrams folder or any diagram in that folder.
Choose New Database Diagram on the shortcut menu.
The Add Table dialog box appears.
Select the required tables in the Tables list and click Add.
The tables are displayed graphically in the new database diagram.

View 1 Replies View Related

SQL 2012 :: Normalization Database Tables

Jan 15, 2015

I have decided to use Wufoo online forms so collect evaluation data from my clients. Each form will have different type of data.

For example

Form 1 might have:
Client id, name, user id, comments

Form 2 might have:
Client id, name, user id, address, comments, telephone number

Form 3 might have:
Client id, name, user id, comments, date of birth, email address

Each form can have over 20+ data types which can be all different to other forms.My question is: What is the best way to store all the data into sql server without creating new columns of new data types everytime a new form is created in wufoo.

View 1 Replies View Related

SQL Server 2012 :: Getting Results From All Tables In Database

Mar 13, 2014

below is my statement to get data from one column (VARCHAR) from table SUPPLY_ITEM_01

SELECT
@@SERVERNAME as ServerName,DB_NAME() AS DatabaseName,
SUM(CASE WHEN CHARINDEX (CHAR(013) , supplydetail) > 0 THEN 1 ELSE 0 END) AS TotalCHAR013,
SUM(CASE WHEN CHARINDEX (CHAR(012), supplydetail ) >0 THEN 1 ELSE 0 END)AS TotalCHAR012,
SUM(CASE WHEN CHARINDEX (CHAR(010), supplydetail ) >0 THEN 1 ELSE 0 END) AS TotalCHAR010,
SUM(CASE WHEN CHARINDEX (CHAR(009),supplydetail ) >0 THEN 1 ELSE 0 END) AS TotalCHAR009
FROM

[code]...

I need to get result from all the tables and all the columns which has bad data including schemaName, table name and column name in result.

View 9 Replies View Related

SQL 2012 :: Replication To A Database With More Tables Than Source

Apr 14, 2015

We need to replicate data from a live database to a reporting database nightly.

There is data which is only needed for the reporting function - namely the selection criteria for reports which are to be run nightly or monthly.

Is it possible to have extra tables in the target database, holding the selection criteria?

If not, we'll have the reports running heterogeneous queries between the target database and a separate database with the selection criteria in it.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved