Error Msg 5105, Level 16 A file activation error occurred - sql

I'm trying to create database manually with below command but I am getting the following error even though my file path is correct:
CREATE DATABASE QuanLySinhVien
ON PRIMARY(
NAME = QLSV_data,
FILENAME = 'E:\HQTCSDL\DaoDuyDan\QLSV_dat.mdf',
SIZE = 10MB,
MAXSIZE = 50MB,
FILEGROWTH = 2MB)
LOG ON(
NAME = QLSVlog,
FILENAME = '‪E:\HQTCSDL\DaoDuyDan\QLSV_log.ldf',
SIZE = 5MB,
MAXSIZE = 20MB,
FILEGROWTH = 1MB)
And it shows the following error:
Msg 5105, Level 16, State 2, Line 2
A file activation error occurred. The physical file name E:\HQTCSDL\DaoDuyDan\QLSV_log.ldf may be incorrect. Diagnose and correct additional errors, and retry the operation.
I've looked but can't find a fix. Any answer is appreciated. Thanks everyone

Had the same problem when running the statement on windows.
My Solution was to replace the / with \.
So while /var/opt/mssql/data/test_data.mdf worked on linux, c:/mssql/data/test_data.mdf didn't worked on windwos.
But c:\mssql\data\test_data.mdf worked on windows.

Hope it helps:
Check any whitespaces in the URL in FILENAME=' .\.\'
Check if you have correct folder directory
Check for permission

Related

Getting Error while creating database in SQL Server 2014

I am using SQL Server 2014 and I am trying to create a database with this command
CREATE DATABASE [EFSDB]
ON (NAME = N'EFSDB_Data', FILENAME = N'$MDF', SIZE = 2, FILEGROWTH = 10)
LOG ON (NAME = N'EFSDB_Log', FILENAME = N'$LDF' , SIZE = 2, FILEGROWTH = 10%)
However, I am getting this error:
A file activation error occurred. The physical file name '$MDF' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Msg 1802, Level 16, State 1, Line 42
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
This command works in SQL Server 2008 but doesn't work in SQL Server 2014.
This command is saved in sample.sql file and that file gets executed using the below command:
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\OSQL.EXE" -S ServerName -E -i Sample.sql

Script timeout passed, resubmit same file and import will resume error in phpmyadmin

I am trying to upload some big data onto phpmyadmin
I am getting this error where it does partial uploads
Script timeout passed, if you want to finish import, please resubmit same file and import will resume.
I have followed this link where it says change the config on \phpmyadmin\libraries\config.default.php
I cannot see this directory in the phpmyadmin. OS Ubuntu
Go to xampp/phpMyAdmin/libraries/config.default.php
find $cfg['ExecTimeLimit'] = 300; line no 695 and replace $cfg['ExecTimeLimit'] = 0;
i think there were problems with your sql codes, try to surrounding your sql codes (edit with text editor eg. notepad++) with following statement :
SET autocommit=0;
SET unique_checks=0;
SET foreign_key_checks=0;
at the beginning, and
COMMIT;
SET unique_checks=1;
SET foreign_key_checks=1;
at the end.
and you could import your sql file once again.
give it a try.

writeOGR error: creation of output file failed

I'm an R rookie and attempting to create home ranges from fish telemetry data using kernel density estimates within the adehabitatHR package
kud <- kernelUD(muskydetectdata.P[,6], h="href", extent = 5)
class(kud)
image(kud)
kud[[1]]#h
muskykud.P95 <- getverticeshr(kud, percent = 95)
muskykud.P95
muskykud.P50 <- getverticeshr(kud, percent = 50)
muskykud.P50
when exporting to a shapefile
writeOGR(muskydetectdata.sp,"musky_kde1", "gps",
driver="ESRI Shapefile",
dataset_options= "FieldName= id")
an error message is displayed
##creation of output file failed
I have also attempted to use writeSpatialShape with similar results
I'm using R version 3.3.2 on windows 64 bit
I had the same problem and have solved it only when I added a full name of my directory and a name of a layer plus a shp suffix:
writeOGR(muskydetectdata.sp, dsn="d:/your directory here/musky_kde.shp", layer="musky_kde", driver="ESRI Shapefile")
I had that same error.
I resolved mine by correcting the directory it was saving to (making sure it existed)
e.g.
writeOGR(muskydetectdata.sp, dsn = save.dir, layer = filename.save, driver = 'ESRI Shapefile')
where save.dir is the directory you want saved as a string and filename.save is the filename you want it saved as (excluding extension)
I guess you are trying to write on an existing file and the writeOGR function don't allow that. I guess this is a known behavior of some drivers supported by OGR (as far as I remember in R as in python and in the C API).
You have to check if the file exists prior to your writing and removing it (or changing the path you want to use).
For example here the first write operation succeed but the attempt to overwrite the file fails with your error message :
> rgdal::writeOGR(spdf, 'b.shp', layer="brazil", driver='ESRI Shapefile')
> rgdal::writeOGR(spdf, 'b.shp', layer="brazil", driver='ESRI Shapefile')
Error in rgdal::writeOGR(spdf, "b.shp", layer = "brazil", driver = "ESRI Shapefile") :
Creation of output file failed

What's the wrong with this code?

I'm new in SSMS, and I'm trying to execute this code:
use master
create database SQL20145Db2
on primary
( name = Sql2015Data2, filename='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Sql2015Data2',
size=4MB, MaxSize=15, FileGrowth= 20%
)
log on
(Name=Sql2015Log2, filename='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Sql2015Log2',
size= 1MB,MaxSize=5Mb,filegrowth=1MB
)
But the messages pane displays this error:
Msg 5123, Level 16, State 1, Line 2
CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Sql2015Data2'.
Msg 1802, Level 16, State 4, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
This error happen because the registry value DefaultData and DefaultLog (which correspond to default data directory) are either empty or does not exists.
See documentation for more information.
Most of the time, these registry values does not exists because they actually need to be accessed as Admin. So, to fix this issue, simply run whatever application you are using to execute the sql as an administrator.

verifyonly error message

I use following sql statement
RESTORE VERIFYONLY FROM DISK = 'F:\testBackup\test_2013-01-18.BAK'
GO
I get this error while doing so:
Attempting to restore this backup may encounter storage space problems. Subsequent messages will provide details.
The path specified by "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test.mdf"
is not in a valid directory.
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test_log.ldf"
failed with the operating system error 3(failed to retrieve text for this error. Reason: 15100).
Msg 3189, Level 16, State 1, Line 1
Damage to the backup set was detected.
Msg 3013, Level 16, State 1, Line 1
VERIFY DATABASE is terminating abnormally.
How do I fix this?
Try to use this:
RESTORE VERIFYONLY
FROM DISK = 'F:\testBackup\test_2013-01-18.BAK'
WITH NORECOVERY,
MOVE 'test_Data'
TO '<YourPath>\test.mdf',
MOVE 'test_Log'
TO '<YourPath>\test_log.ldf';
And you can check MSDN site to further advices.