This option does not work if for multiple data files.....
And Navision creates two data files.
Running
Create DATABASE mee
ON (NAME='mee',FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\tada_Data.mdf')
FOR ATTACH_REBUILD_LOG
will give you an error
Msg 5120, Level 16, State 5, Line 1
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\tada_1_Data.ndf". Operating system error 2: "2(The system cannot find the file specified.)".
File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\tada_Log.ldf" may be incorrect.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'mee'. CREATE DATABASE is aborted.
Ahmed Rashed Amini
Independent Consultant/Developer
sp_attach_single_file_db @dbname= 'new_Demo Database NAV (6-0)', @physname= 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Database - Copy\Demo Database NAV (6-0)_Data.mdf'
You need to ensure that the SQL server user have correct permissions to 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Database - Copy\' or where you put the db files. I'm using 'NETWORK SERVICE" as the SQL server user account, the NAV will use this account by default when doing demo installation.
To set permission
1. Open propertie for the directory.
2. Click secyrity tab
3. Click advance
4. Click edit
5. If the SQL server user are not pressent press add and pick the user else select the SQL server user and click edit
6. Change the permission according to the picture
7. Click OK
8. Click Ok
9. Click OK
10. Click OK
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
You just need the mdf file.
Create a new Query.
Attach the Database by SQL Statement with Option Rebuild_Log.
Lukas
EXEC sp_attach_single_file_db @dbname = 'mee',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\mee_Data.mdf'
doesn't work.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Create DATABASE [mee]
ON Filename = 'c:\.....'
FOR ATTACH_REBUILD_LOG
Lukas
And Navision creates two data files.
Running
will give you an error
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I hope you solved the Problem.
If not, then you should use as second Parameter
FILEGROUP to attach the NDF-File
Lukas
sp_attach_single_file_db @dbname= 'new_Demo Database NAV (6-0)', @physname= 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Database - Copy\Demo Database NAV (6-0)_Data.mdf'
You need to ensure that the SQL server user have correct permissions to 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Database - Copy\' or where you put the db files. I'm using 'NETWORK SERVICE" as the SQL server user account, the NAV will use this account by default when doing demo installation.
To set permission
1. Open propertie for the directory.
2. Click secyrity tab
3. Click advance
4. Click edit
5. If the SQL server user are not pressent press add and pick the user else select the SQL server user and click edit
6. Change the permission according to the picture
7. Click OK
8. Click Ok
9. Click OK
10. Click OK
Peter Wibeck
Software Development Engineer in Test
Dynamics NAV Server and Installer team
http://blog.wibeck.org/