Retrieve database information from DBML files - sql-server

I'm working on one project using ASP.Net 4.0 and SQL Server 2012. I have used DBML files for data access layer and Unfortunately, the database is got corrupted due to hard disk crash and not able to get the database.
Is it possible to retrieve the following things from DBML?
Tables (I didn't drag the tables into DBML before)
Stored procedures with body
Triggers
Help would be highly appreciated .
Thanks,
Dhaval

Short answer is no. If you have database backups you can restore these and get the details from there.
If you don’t have these but your database was in full recovery mode you can try to examine transaction log and see if you can get any info from there.
See this for more details
SQL Server Transaction Log Explorer/Analyzer

Related

porting over database changes to SQL Server Reporting Services to avoid breaking reports

When database changes are made (tables and column names renamed or eliminated), my shop struggles with broke reports which we react to after deployment. There is no established practice to fix the reports to reflect the changes before going live with the database changes.
I have the databases set up as SQL Server database projects in VS and have them committed to GIT. The reporting services files (.rdl files) are in GIT as well. Googled everywhere to see if a database project can be connected to no avail.
Whenever a database object is changed (renamed a column for example) in a database project, I am looking for an efficient way to fix the references to the renamed column in the SQL Server Reporting Services project.
From my experience, the best practice is using stored procedures as data source instead of writing sql query in the report. that way you can simply edit the query inside report stored procedure whenever necessary.
If not you have to open the report and then edit the query and redeploy the report.
Tip: whenever you come across a SQL query as dataset source in SSRS, change it to stored
procedure ASAP. it's easy, because you already have the query.

Database Migration Approach

I have a few databases that I want to migrate to another server. These are production Databases, what is the best way to Migrate
1) Take full back up of the Current Databse and then Restore it on to the other Server.
or
2) Detach and then Copy the mdf/ldf files on the Destination Server and then attach the files there.
I know that after Migrating Sql Logins and Sql Agent Jobs will have to be created manually. Are there any other risks that come to mind?
Any help will be helpful.
Thanks,
Ben
For Login transfer use "sp_help_revlogin" you get the script
https://support.microsoft.com/en-us/kb/918992
this Stored procedure list out all the instance login not particular database login. One special thing about this stored procedure is no need to do orphaned fix. Just migrate the logins and check. It works.

Attaching Database

I am very new to Sequel Server. For Practice, I created a Database where I imported some sample datasets (mostly excel files) via SSIS. The database consists of 6 tables. I was wondering if there is a way I can send the database (I created) via email or share it by any other way. Like Adventureworks was available for download and also for attaching to SQL SERVER, is there a way I can do the same for my practice database?
Thank you,
Regards,
Sourav
You can backup the database you created to a file and send it over to anyone. Right click on your database, Tasks -> Backup

SSMS And Visual Basic Express .... cannot backup

Let us start with...yes I am new to SQL and really only a lightweight programmer. So I am assuming that I am doing something horribly wrong. I have spent days on the MS forums looking for an answer to no avail. So I am going to give as much info as possible.
Application language is VBExpress 2010 and using SQLExpress 2008. The Database contain basic tables, no stored procs, no views, no diagrams. The Application has configured diagrams where one of the tables has inner joins... Tables origninally built in SSMS, but have been altered in VBE.
Anytime I run the application, even after exiting the application, if I then go to SSMS I can see the database name but I cannot open it up (no + beside it). If I try I get an error that says:
One or more files do not match the primary file of the database. If you are attempting to attach a database retry the operation with the correct files. If this is an existing database the file may be corrupted and should be restored from a backup."
When I look at the files, I see two log files, one with _1 appended on to it. If I delete the logfiles before opening SSMS, everything opens fine. If I had already opened SSMS then I have to delete the files, reboot my computer and then I can access the database through SSMS...
I recently found that if I go into SSMS, take the database offline and then bring it back online I can get access back.
Anytime I open SSMS, I have to completely reboot my computer before VBE will reconnect the database.
The bottom line is that I cannot back up the database without either deleting the log files or doing an offline/online cycle in SSMS....
This is driving me nuts. I cannot possilby deploy the application if I cannot achieve a normal backup procedure. And I cannot seem to get any kind of answer about why this is happening.
What am I doing so WRONG?
If you are using SQL Server 2008 then, reattach the database files and it will must be stored in C:\Program Files\Microsoft SQL Server\MSSQL 10.MSSQLSERVER\MSSQL\DATA.
And recheck the database on that folder and it will take backup and restore point of Primary files of Database. Don't modify/delete the database files. If the location of log files are changed the it will shows the error. Please give your mail id I'll send a program to restore and backup of database files in winrar.
Thank you
Regards,
Naresh.

When restoring a database in SQL Server 2008, how to ignore the users?

I am importing a SQL Server 2000 database to my SQL Server 2008 server.
I don't want to import any user/permission information, is there a way to ignore this?
The current restoration is causing me issues as it has users tied to the db.
A restore includes users and permissions. You could restore the database in "dbo only" mode, which would give you time to remove all users before the database came back online.
The restore operation is a physical operation, it restores data pages. It really knows absolutely nothing about the meaning the pages. As it turns out, some of the pages belong to catalog views that store information about users and permissions. There is absolutely no way to restore only 'part' of the database, as in to ignore certain catalog views.
Can you detail exactly what are the 'issues' you encounter with the users after the restore?

Resources