-
One Script to Backup All SQL Databases
Posted on August 15th, 2011 Add commentsIt’s a nightmare for backup your DB if you have 100+ DB’s in SQL server. Just simply run a script while you taking a coffee:
12345678910111213141516171819202122232425262728DECLARE @name VARCHAR(50) -- database nameDECLARE @path VARCHAR(256) -- path for backup filesDECLARE @fileName VARCHAR(256) -- filename for backupDECLARE @fileDate VARCHAR(20) -- used for file nameSET @path = "C:\Backup"SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)DECLARE db_cursor CURSOR FORSELECT nameFROM master.dbo.sysdatabasesWHERE name NOT IN ('master','model','msdb','tempdb')--skip system database (optional)OPEN db_cursorFETCH NEXT FROM db_cursor INTO @nameWHILE @@FETCH_STATUS = 0BEGINSET @fileName = @path + @name + '_' + @fileDate + '.BAK'BACKUP DATABASE @name TO DISK = @fileNameFETCH NEXT FROM db_cursor INTO @nameENDCLOSE db_cursorDEALLOCATE db_cursor
263 views
-
Visual Studio Website Administration Tool & SQL Server Express
Posted on June 24th, 2010 1 commentIn Visual Studio the Website Administration Tool lets you view and manage the Web site configuration through a simple Web interface. But sometimes there is problem which is when using the Website Administration Tool to make a new connection for a new website, for example, using the security tab of the Website Administration Tool to manage rules for securing specific resources in the web application or website, it will display an error message “Unable to connect to SQL Server database”, even you have SQL Server Express installed and no problem to connect to it.
To solve this problem, try one or more of the following ways:
Read the rest of this entry »
888 views
-
ORACLE databse can not start by missing tablespace file
Posted on February 13th, 2010 1 commentToday, as usual, trying to login to Oracle database do something, but when typing “sqlplus” and username/password, it showing:
12ERROR :ORA-01033: ORACLE initialization or shutdown in progressIt seems like Oracle database was not starting somehow. After connect the database as SYSDBA, type some command for trying to restart the datadase:
12345678910111213141516SQL> shutdown immediate;ORA-01109: database not openDatabase dismounted.ORACLE instance shut down.SQL> startupORACLE instance started.Total System Global Area 171966464 bytesFixed Size 787988 bytesVariable Size 145750508 bytesDatabase Buffers 25165824 bytesRedo Buffers 262144 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 6 - see DBWR trace fileORA-01110: data file 6: '/home/XXX/XXX.dbf'Now finally realized what happened and how this happened. There is a tablespace file “XXX.dbf” missing. To solve this issue, connect database as SYSDBA, then:
123SQL> alter database datafile 'XXX.dbf' offline drop;SQL> shutdown immediate;SQL> startup;
584 views
-
Create tablespace on NFS based LINUX + Oracle
Posted on February 8th, 2010 Add commentsWhen the first time to create tablespace on SQLplus, it shows:
“ORA-27040: file create error, unable to create file. Linux-x86_64 Error: 13: Permission denied”
So I just change my home directory to “777”, then getting the error
“ORA-27054: NFS file system where the file is created or resides is not mounted with correct options”
After check the “autofs” settings, I found the content of file “auto.home” has problem which is something wrong with NFS mount options. The solutions is change the original content
* -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp oracle.server.com:/users/&
to
* -rw,bg,hard,intr,rsize=32768,wsize=32768,suid,nfsver=3,tcp oracle.server.com:/users/&
918 views
Recent Comments