pg_restore: [directory archiver] could not open input file. Error while trying to restore DB - sql

Error when trying to restore a backup file(.nb3).
I did a database backups in Navicat, one backup for each schema. They are .nb3 files.
I tried to restore my DB on a local server using pgAdmin. I got an error like this after choosing backup file :
How do I restore the database on a local server?

NB3 NaviCat backup files can be restored using the NaviCat software.
Add the database connection in NaviCat
Double click on the connection and go to Backup
Right-click on the empty backup window and select "Restore from..." from the menu
Select your nb3 file

Related

Restore BacPac database backup in sql server 2014

I have database backup file with extension .bacpac so how can i restore it in sql server 2014 ?
Two options:
In SQL Server Management Studio, right-click on the Databases folder in the Object Explorer tree. Then click on "Import Data-tier application". The wizard will guide you through the process.
From the command line, run this command: "c:\program files (x86)\Microsoft sql server\120\dac\bin\sqlpackage.exe" /a:import /sf:"PATH_TO_YOUR_BACPAC_FILE" /tcs:"Data Source=YOUR_SERVER_NAME;Initial Catalog=NEW_DATABASE_NAME;Integrated Security=true"
Aside: Note that the example connection string in the command line option above assumes you're using Windows Authentication instead of SQL Server authentication to access the server.

SQL Server 2012 locate backup file not displaying file structure

I have recently installed SQL Server 2012 Express. When I try and restore a previous database, the "Locate Backup File" box is not displaying correctly:
When I maximise the window, it looks like this:
Which means that I can't select a backup. But has anyone else had this issue and how was it resolved?
I'm not sure how to fix the UI problem, but if you want to restore your database, run this code.
RESTORE DATABASE yourDatabaseName
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\Backup\yourDatabaseName.bak';

Database wont attach to Microsoft SQL Server Management Studio

I'm trying to attach a database to Microsoft SQL Server Management Studio. I have moved the .MDF file into C:\programfiles\Microsoft SQL Server\MSSQL11.MSSQLEXPRESS\MSSQL\Data
It shows up when I go to the attach screen but I get this error message when I hit 'OK' on the attach screen:
Attach database failed for Server 'DESKTOP-5DHLE7T\sqlexpress'.
(Microsoft.SqlServer.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf" failed with the operating system error 3 (The system cannot find the path specified.). (Microsoft SQL Server, Error: 5133)
My instructions say to attach the database to C:\programfiles\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data . However despite completing the exact same installation as the guide I don't have a MSSQL11.MSSQLSERVER path, only the C:\programfiles\Microsoft SQL Server\MSSQL11.MSSQLEXPRESS\MSSQL\Data like I stated earlier.
Is this where my problem lies? If so, where should I be putting the .MDF file before I attach it? Any ideas will be much appreciated
First of all, you are attaching the files to your database server, not Management Studio.
Second, your error is about a log file missing. You actually don´t need the LDF just to attach the file, but you need to do some work to make it happen:
USE [master] GO
-- Method 1: I use this method
EXEC sp_attach_single_file_db #dbname='TestDb',
#physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\YourDBFile.mdf'
GO
Or, you can also do this:
CREATE DATABASE TestDb ON
(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\YourDBFile.mdf')
FOR ATTACH_REBUILD_LOG
GO
The error message is saying the LDF file is missing. You need both the MDF and the LDF.
You can click the second file with type is LDF and hit "Remove"

Why can't I attach an MDF file to SQL Server 2012 Express

I've tried using SSMS but when I click Attach I get error File Not Found. This is AdventureWorks2012_Data.mdf. There is no LDF file. I tried exec'ing this as well:
EXEC sp_attach_single_file_db #dbname='AdventureWorks2012',
#physname = N'R:\SqlServer\AdventureWorks2012_Data.mdf'
GO
but I get the same error:
failed with the operating system error 2 (The system cannot find the file specified.).
TRY the below snippet and you will be through without a .ldf file.
create database AdventureWorks2012_Data
on
(FILENAME='D:\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG
GO

SQL LocalDB - Cannot delete a DB when its files are deleted

How can I delete a SQL LocalDB database that has had its files delete?
Dropping the database yields this message:
Unable to open the physical file "C:\Users\Public\Documents\LocalDB.Tests.3d0d7339-7cf2-45fe-a83b-b5079112ab80.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
File activation failure. The physical file name "C:\Users\Public\Documents\LocalDB.Tests.3d0d7339-7cf2-45fe-a83b-b5079112ab80_log.ldf" may be incorrect.
Running master.sp_databases actually doesn't show them, but the Management Studio does.
The problem is that you are trying to drop a database when the physical file has been deleted or couldn't be found.
To get around this you can detach the database. Detaching will drop the database without attempting to remove the file from the filesystem.
EXEC sp_detach_db 'My_Db'
I'm assuming you're using (localdb) bundled with SQL Server 2012.
If you're using SQL Server 2014, use (localdb)\MSSQLLocalDB in place of (localdb)\v11.0 below
Open a command prompt
Start the localDb instance if it is not already running: “C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqllocaldb.exe” start “v11.0″
Drop the localDb database by running the following command: “C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd” -S (localdb)\v11.0 -E -d master -Q “DROP DATABASE [myDatabase]”
You can stop the localDb service now: “C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqllocaldb.exe” stop “v11.0″
Source: http://kazimnami.azurewebsites.net/techblog/2013/02/27/delete-localdb-database-after-physical-files-have-been-deleted/