How
to backup asymmetric key in SQL 2005 created in the following way so it
can be copied to another server ? Also can you copy it to the other
server after backing it up.
CREATE ASYMMETRIC KEY ccnumber WITH ALGORITHM = RSA_512
ENCRYPTION BY PASSWORD = 'password';
Hi I created an sqlserverproject successfuly ( just has one CLR stored proc) (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/mandataaccess.asp) i followed above steps to create the project. when i tried to deploy the same to sql server VS studio threw below error CREATE ASSEMBLY for assembly 'MySqlServerProject' failed because assembly 'MySqlServerProject' is not authorized for PERMISSION_SET = EXTERNAL_ACCESS. The assembly is authorized when either of the following is true: the database owner (DBO) has EXTERNAL ACCESS ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission. MySqlServerProject then i realized i will have to either sign the assembly or create an asymmetric key. i decied to follow the latter. so i tried below t-sql statements in sql sever 2005 use master GO CREATE ASYMMETRIC KEY SQLCLRTestKey FROM EXECUTABLE FILE = 'C:myWorkSQL2005DBProMySqlServerProjectMySqlServerProjectinDebugMySqlServerProject.dll' when i execute the above, SQL Server threw below error The certificate, asymmetric key, or private key file does not exist or has invalid format. What i am i doing wrong. please advise THNQDigital
Hi, I am trying to create an asymmetric key to have EXTERNAL ACCESS ASSEMBLY for an SQL login. When I try to run following script. it gives error 1 User master2 GO 3 CREATE ASYMMETRIC KEY SN FROM EXECUTABLE FILE = 'D:Partners.dll' 4 CREATE LOGIN TestLogin FROM ASYMMETRIC KEY SN 5 GRANT EXTERNAL ACCESS ASSEMBLY TO TestLogin6 GO7 Error is "The certificate, asymmetric key, or private key file does not exist or has invalid format." Any help how can I fix this error. The database already have Trustworth ON.
i've getting ready to implement encryption on a rather large database. I'd read that if performance is of utmost concert, you should use symmetric keys. I want to encrypt those keys by asymmetric keys. My code is working, but i'm just not sure if there is a quicker way? do you have to open and close the key each time you select/update/insert in a stored procedure that references an encrypted column, or is there a way to just modify the code by adding the encryptbykey/decryptbykey functions?
has anyone implemented encryption on columns in large tables? any suggestions for me?
Thanks, Pete
here's my code to create the keys:
create asymmetric key ASK_Auto_Encrypt with algorithm = RSA_512;
create symmetric key SK_AE with algorithm = TRIPLE_DES encryption by asymmetric key ASK_Auto_Encrypt;
here's my code to test this:
create table encryption_test (test varchar(50));
open symmetric key SK_AE decryption by asymmetric key ASK_Auto_Encrypt;
insert into encryption_test select encryptbykey(key_guid('SK_AE'),'test');
select convert(varchar(max),decryptbykey(test)) from encryption_test;
I'm trying to create assembly with "PERMISSION_SET = UNSAFE". For that I've signed assembly's .dll and installed root certificate to €œTrusted Root Certificate Authority.€?: http://www.sqljunkies.com/WebLog/ktegels/articles/SigningSQLCLRAssemblies.aspx now I'm trying to create login from asymmetric key:
USE master GO
CREATE ASYMMETRIC KEY SQLCLRTestKey FROM EXECUTABLE FILE = 'C:Documents and SettingsAll UsersDocumentshunterStoredProcedures.dll' CREATE LOGIN SQLCLRTestLogin FROM ASYMMETRIC KEY SQLCLRTestKey
but I'm receiving error: "Cannot find the asymmetric key 'SQLCLRTestKey', because it does not exist or you do not have permission."
We have a curious situation on a SQL 2014 DB, with Trustworthy set to OFF. There is a job that runs a data export to a file via a CLR. The assembly as PERMISSION_SET = EXTERNAL_ACCESS, however there is no Asymmetric key for the assembly. Therefore what I trying to work out is why this is NOT failing. Some further information on this specific database that may or may not be relevant is:
1. It was upgraded a few weeks ago (Backup/Restore) from a SQL 2012 - SQL 2014 server 2. It as a Compatibility Level = 110 (2012) 3. The Previous 2012 database DID have Trustworthy ON 4. The CLR are actually being run against a snapshot of the database (Actually I think this one is a red herring. The SP is getting data from a table in the snapshot, but the CLR used it the one from the main DB)
We are planning to encrypt few fields using asymmetric encryption. Tyring share public key with users and retain private key with us. How to generate keys? Haven't found any solid document on how to generate these keys.
I am sure I'm being dumb here but I am trying to deploy an assembly with external_access.
I have signed the assembly using the <new> option in the project properties.
When I then try and create the Key I get the above error using the code below.
CREATE ASYMMETRIC KEY SQLExtensionUDTKey
FROM EXECUTABLE FILE = 'C:Documents and SettingsSimon SabinMy DocumentsVisual Studio 2005ProjectsSQLBitsCoreSQLExtensionsSQLExtensions.UDTinDebugSQLExtensions.UDT.dll'
I wanted to check the asymmetric key option in sql 2005. I copied the books online code for creating a asymmetric key and then used this key for creating a login. Now when I try to login without entering any password I am receiving 18456 error. I would like to know what I am missing here. If I use CREATE LOGIN from asymmetric key or certificate how do I login and with what credentials. Do I need to provide any password.CREATE ASYMMETRIC KEY PacificSales09 WITH ALGORITHM = RSA_2048 ENCRYPTION BY PASSWORD = 'bmsA$dk7i82bv55foajsd9764'; GO
CREATE LOGIN asm FROM ASYMMETRIC KEY PacificSales09;
I would like to ask you if there is better to recreate database structure on 2005 from 2000 and move data or to just load 2000 backup.
Currently I loaded the backup, but I am wondering if there might be slightly better performance on 2005 when recreating structure on 2005 to loading 2000 backup?
Does loading 2000 backup create 2005 binary structure?
I'm getting this message on my third automated backup of the transaction logs of the day. Both databases are in full recovery mode, both successfully backed up at 01.00. The transaction logs backed up perfectly happily at 01:30 and 05:30, but failed at 09:30.
The only difference between 05:30 and 09:30's backups is that the log files were shrunk at 08:15 (the databases in question are the ones that sit under ILM2007, and keeping the log files small keeps the system running better).
Is it possible that shrinking the log files causes the database to think that there hasn't been a full database backup?
I have ctreated a maintenance plan to backup a database daily. The option is set to overwrite.
1) How is it possible to allow for say four days of backup files to remain but any older backups to be deleted. At present I only get one file which gets overwritten every day.
2) What does the Append database option do? I know that it increases the backup file size on every backup. Not sure what that does to the file internally. i.e. why doe the file size increase even if there has not been any activity on the database on that day?
Hi, I'm trying to setup a Maintenance Plan under SQL2005 to backup selected DB's to a UNC share for later backup to tape. This was easy and straightforward under SQL2k, but doesn't seem to be as simple under 2005 as I've been unable to get it to work.
I have the Maint. Plan created and working to backup to the local drive, but am unable to get it to work to a UNC.
Hello,I am learning SQL Server 2005. I need to know how to make a backup ofa database. I tried (according to my book):BACKUP DATABASE DemoSQLServer TO DISK = "G:DemoSQLServer.bak"But I got error:Incorrect syntax near 'G:DemoSQLServer.bak'.Please help.Thank you very much./RAM/
I created a job to backup my database. Sometimes I get the following error: The job failed. Unable to determine if the owner (DOMAINAdministrator) of job Backup.Subplan_1 has server access (reason: Could not obtain information about Windows NT group/user 'DOMAINAdministrator'<c/> error code 0x54b. [SQLSTATE 42000] (Error 15404))
I already deleted the job and made it again. Same problem. I don't get that error every day. For example: I got it 4 times last month.
Does anybody know what I can do to resolve the error?
I know I've been posting a lot about another problem but you all have been most helpful so I thought I'd throw this one at you too.
My nephew's company has a server with Small Business Server 2003 SP1 and they run Windows Backup for their daily backups. They also have SQL 2005 Workgroup on that machine. Prior to SQL 2005, they ran SQL 7 and had no problems with their daily backups. Once they upgraded (clean installed actually) SQL 2005 their backups fail. The event log errors with Event ID 6013 and says:
SQLlib error: OLEDB Error encountered calling IDBInitialize::Initialize. hr=0x80004005 SQLSTATE: 08001, Native Error: 17 Error state: 1, Severity: 16 Source: Microsoft OLE DB Provider for SQL Server Error Message: [DBNETLIB][ConnectionOpen[Connect[]].]SQL Server does not exist or access denied.
Obviously, SQL Server does exist, so I presume it has to do with an access denial. Microsoft has been no help and Googling other sites have gotten nowhere. DLL updates have been done and hot fixes installed. But the error persists.
I have sent a mssql backup file in .bak format to my host admin and asked them restore it. but they told me there are 3 files with 3 different dates in that backup what does it mean? should I ask them to restore all of them or just the last one? Thanks very much in addvance (context: MS SQL 2005 express)
We have a SQL 2005 server running the following backup job:<font face="Courier New" size="2"><br><font color="blue">/* Created by<a href="http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm">freeonline sql formatter</a*/</font><br><br><font color = "blue">EXECUTE</font> <font color ="maroon">master</font><font color = "silver">.</font><font color ="maroon">dbo</font><font color = "silver">.</font><font color ="#8000FF">xp_create_subdir</font><br> <font color = "red">N'\ServerBackupsDBServerName\DB_Name__METABASE'</font><br><br><font color = "blue">GO</font><br><br><font color = "blue">EXECUTE</font> <font color ="maroon">master</font><font color = "silver">.</font><font color ="maroon">dbo</font><font color = "silver">.</font><font color ="#8000FF">xp_create_subdir</font><br> <font color = "red">N'\serverBackupsDBServerName\DB_Name__MSCRM'</font><br><br><font color = "blue">GO</font><br><br><font color = "blue">BACKUP</font> <font color = "blue">DATABASE</font> <font color = "maroon">[db_name__metabase]</font> <font color = "blue">TO</font> <font color ="maroon">disk</font> <font color = "silver">=</font> <fontcolor = "red">N'\serverBackupsDBServerName\DB_Name__METABASE DB_Name__METABASE_backup_200610261158.bak'</font> <font color ="blue">WITH</font> <font color = "maroon">differential</font> <font color = "silver">,</font> <font color ="maroon">noformat</font> <font color = "silver">,</font> <font color = "maroon">noinit</font> <font color ="silver">,</font> <font color = "maroon">name</font> <fontcolor = "silver">=</font> <font color ="red">N'DB_Name__METABASE_backup_20061026115839'</font> <fontcolor = "silver">,</font> <font color = "maroon">skip</font> <font color = "silver">,</font> <font color ="maroon">rewind</font> <font color = "silver">,</font> <fontcolor = "maroon">nounload</font> <font color = "silver">,</font> <font color = "maroon">stats</font> <font color ="silver">=</font> <font color = "black">10</font><br><br><font color = "blue">GO</font><br><br><font color = "blue">DECLARE</font> <font color ="#8000FF">@backupSetId</font> <font color = "blue">AS</font> <font color = "black">INT</font><br><br><font color = "blue">SELECT</font> <font color ="#8000FF">@backupSetId</font> <font color = "silver">=</font> <font color = "maroon">position</font><br><font color = "blue">FROM</font> <font color ="maroon">msdb</font><font color = "silver">.</font><font color ="silver">.</font><font color = "maroon">backupset</font><br><font color = "blue">WHERE</font> <font color ="maroon">database_name</font> <font color = "silver">=</font> <font color = "red">N'DB_Name__METABASE'</font><br> <font color ="blue">AND</font> <font color = "maroon">backup_set_id</font> <font color = "silver">=</font> <font color ="silver">(</font><font color = "blue">SELECT</font> <font color ="fuchsia"><b>MAX</font></b><font color = "silver">(</font><font color= "maroon">backup_set_id</font><font color = "silver">)</font><br> <fontcolor = "blue">FROM</font> <font color ="maroon">msdb</font><font color = "silver">.</font><font color ="silver">.</font><font color = "maroon">backupset</font><br> <fontcolor = "blue">WHERE</font> <font color ="maroon">database_name</font> <font color = "silver">=</font> <font color = "red">N'DB_Name__METABASE'</font><font color= "silver">)</font><br><br><font color = "blue">IF</font> <font color ="#8000FF">@backupSetId</font> <font color = "blue">IS</font> <font color = "blue">NULL</font><br> <font color = "blue">BEGIN</font><br> <font color = "blue">RAISERROR</font> <font color = "silver">(</font><font color ="red">N'Verify failed. Backup information for database ' 'DB_Name__METABASE'' not found.'</font><font color = "silver">,</font><font color = "black">16</font><font color = "silver">,</font><font color = "black">1</font><font color = "silver">)</font><br> <font color = "blue">END</font><br><br><font color = "blue">RESTORE</font> <font color ="maroon">verifyonly</font> <font color = "blue">FROM</font> <font color = "maroon">disk</font> <font color ="silver">=</font> <font color = "red">N'\serverBackupsDBServerName\DB_Name__METABASEDB_Name__METABASE_backup_200610261158.bak'</font> <font color ="blue">WITH</font> <font color = "blue">FILE</font> <fontcolor = "silver">=</font> <font color = "#8000FF">@backupSetId</font> <font color = "silver">,</font> <font color ="maroon">nounload</font> <font color = "silver">,</font> <font color = "maroon">norewind</font><br><br><font color = "blue">GO</font><br><br><font color = "blue">BACKUP</font> <font color = "blue">DATABASE</font> <font color = "maroon">[db_name__mscrm]</font> <fontcolor = "blue">TO</font> <font color = "maroon">disk</font> <font color = "silver">=</font> <font color = "red">N'serverBackupsDBServerName\DB_Name__MSCRMDB_Name__MSCRM_backup_200610261158.bak'</font> <font color ="blue">WITH</font> <font color = "maroon">differential</font> <font color = "silver">,</font> <font color ="maroon">noformat</font> <font color = "silver">,</font> <font color = "maroon">noinit</font> <font color ="silver">,</font> <font color = "maroon">name</font> <fontcolor = "silver">=</font> <font color ="red">N'DB_Name__MSCRM_backup_20061026115839'</font> <font color= "silver">,</font> <font color = "maroon">skip</font> <fontcolor = "silver">,</font> <font color = "maroon">rewind</font> <font color = "silver">,</font> <font color ="maroon">nounload</font> <font color = "silver">,</font> <font color = "maroon">stats</font> <font color ="silver">=</font> <font color = "black">10</font><br><br><font color = "blue">GO</font><br><br><font color = "blue">DECLARE</font> <font color ="#8000FF">@backupSetId</font> <font color = "blue">AS</font> <font color = "black">INT</font><br><br><font color = "blue">SELECT</font> <font color ="#8000FF">@backupSetId</font> <font color = "silver">=</font> <font color = "maroon">position</font><br><font color = "blue">FROM</font> <font color ="maroon">msdb</font><font color = "silver">.</font><font color ="silver">.</font><font color = "maroon">backupset</font><br><font color = "blue">WHERE</font> <font color ="maroon">database_name</font> <font color = "silver">=</font> <font color = "red">N'DB_Name__MSCRM'</font><br> <font color ="blue">AND</font> <font color = "maroon">backup_set_id</font> <font color = "silver">=</font> <font color ="silver">(</font><font color = "blue">SELECT</font> <font color ="fuchsia"><b>MAX</font></b><font color = "silver">(</font><font color= "maroon">backup_set_id</font><font color = "silver">)</font><br> <fontcolor = "blue">FROM</font> <font color ="maroon">msdb</font><font color = "silver">.</font><font color ="silver">.</font><font color = "maroon">backupset</font><br> <fontcolor = "blue">WHERE</font> <font color ="maroon">database_name</font> <font color = "silver">=</font> <font color = "red">N'DB_Name__MSCRM'</font><font color ="silver">)</font><br><br><font color = "blue">IF</font> <font color ="#8000FF">@backupSetId</font> <font color = "blue">IS</font> <font color = "blue">NULL</font><br> <font color = "blue">BEGIN</font><br> <font color = "blue">RAISERROR</font> <font color = "silver">(</font><font color ="red">N'Verify failed. Backup information for database ' 'DB_Name__MSCRM'' not found.'</font><font color = "silver">,</font><font color = "black">16</font><font color = "silver">,</font><font color = "black">1</font><font color = "silver">)</font><br> <font color = "blue">END</font><br><br><font color = "blue">RESTORE</font> <font color ="maroon">verifyonly</font> <font color = "blue">FROM</font> <font color = "maroon">disk</font> <font color ="silver">=</font> <font color = "red">N'\serverBackupsDBServerName\DB_Name__MSCRMDB_Name__MSCRM_backu p_200610261158.bak'</font> <font color = "blue">WITH</font> <font color ="blue">FILE</font> <font color = "silver">=</font> <fontcolor = "#8000FF">@backupSetId</font> <font color = "silver">,</font> <font color = "maroon">nounload</font> <font color ="silver">,</font> <font color = "maroon">norewind</font></font>This job was set up long before i started here and the problem is thatthe backup file itself has grown to be over 230 GB. It does notappear that the backup job is pruning the file. is there a way toview the contents of this file and then prune it so we keep no morethen two weeks worth of data.Thanks
We have a SQL 2005 server running the following backup job:EXECUTE master.dbo.xp_create_subdirN'\ServerBackupsDBServerName\DB_Name__METABASE 'GOEXECUTE master.dbo.xp_create_subdirN'\serverBackupsDBServerName\DB_Name__MSCRM'GOBACKUP DATABASE [db_name__metabase] TO disk = N'\serverBackupsDBServerName\DB_Name__METABASEDB_Name__METABASE_backup_200610261158.bak' WITH differential ,noformat , noinit , name =N'DB_Name__METABASE_backup_20061026115839' , skip , rewind ,nounload , stats = 10GODECLARE @backupSetId AS INTSELECT @backupSetId = positionFROM msdb..backupsetWHERE database_name = N'DB_Name__METABASE'AND backup_set_id = (SELECT MAX(backup_set_id)FROM msdb..backupsetWHERE database_name =N'DB_Name__METABASE')IF @backupSetId IS NULLBEGINRAISERROR (N'Verify failed. Backup information for database''DB_Name__METABASE'' not found.',16,1)ENDRESTORE verifyonly FROM disk = N'\serverBackupsDBServerNameDB_Name__METABASEDB_Name__METABASE_backup_200610 261158.bak' WITHFILE = @backupSetId , nounload , norewindGOBACKUP DATABASE [db_name__mscrm] TO disk = N'\serverBackupsDBServerName\DB_Name__MSCRMDB_Name__MSCRM_backu p_200610261158.bak'WITH differential , noformat , noinit , name =N'DB_Name__MSCRM_backup_20061026115839' , skip , rewind , nounload ,stats = 10GODECLARE @backupSetId AS INTSELECT @backupSetId = positionFROM msdb..backupsetWHERE database_name = N'DB_Name__MSCRM'AND backup_set_id = (SELECT MAX(backup_set_id)FROM msdb..backupsetWHERE database_name = N'DB_Name__MSCRM')IF @backupSetId IS NULLBEGINRAISERROR (N'Verify failed. Backup information for database''DB_Name__MSCRM'' not found.',16,1)ENDRESTORE verifyonly FROM disk = N'\serverBackupsDBServerNameDB_Name__MSCRMDB_Name__MSCRM_backup_200610261158 .bak' WITH FILE =@backupSetId , nounload , norewindThis job was set up long before i started here and the problem is thatthe backup file itself has grown to be over 230 GB. It does notappear that the backup job is pruning the file. is there a way toview the contents of this file and then prune it so we keep no morethen two weeks worth of data.Thanks
I have ctreated a maintenance plan to backup a database daily. The option is set to overwrite.
1) How is it possible to allow for say four days of backup files to remain but any older backups to be deleted. At present I only get one file which gets overwritten every day.
2) What does the Append database option do? I know that it increases the backup file size on every backup. Not sure what that does to the file internally. i.e. why doe the file size increase even if there has not been any activity on the database on that day?
Want to backup the transactoin log, but I have the failure:
The statement BACKUP LOG is not allowed while the recovery model is SIMPLE. Use BACKUP DATABASE or change the recovery model using ALTER DATABASE. [SQLSTATE 42000] (Error 4208) BACKUP LOG is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
I set the recovery model to FULL, that worked fine for about six hours. After same failure again. And the recovry model was SIMPLE. Found this in the Eventlog:
Setting database option RECOVERY to SIMPLE for database
I am new to sql server 2005.I am trying to set up databse backup using databse management.but some how it is not working and i am getting error after all settings done.
Can any one have experience on this. plz i am in desperate trouble.
I am very new to SQL 2005. I need to automate backup for the SQL server which can take backup of all databases from the server at fixed time without using third party backup system. Thank you for help.
I have recently installed the sql server 2005 on my server. I am going to setting up the maintenance plan to backing up my DB on the network. I can do it locally but i want to backup directly into the shered folder on the network.
I use SQL 2005 Database in my ASP.Net 2.0 site, I have to require admin backup db for me every time, I hope to I can backup by myself , how can I do? You know Microsoft SQL Server Database Publishing Wizard can restore DB easily! Many thanks!