Problem in Restoring the database the database
Hi guys,
I am new to oracle , I am facing one problems is that , i having the backup of one oracle database in .dmp format.
I have to restore it to 9i database. for that i have created on database , how to restore the backup file over the new database using oracle management server.
Please give me the clue to do the things.
1. setup your oracle environmentals and path. Usually this is easy to do if your database name is in your oratab file. From the command line type . oraenv -- that is dot-space-oraenv. When prompted enter the database sid in the same case that it is in the oratab file.
2. from the command prompt enter
imp file=<your dump file name> log=<your import log file name> full = y, ignore = y
You will be prompted for username and password.
More detailed information is available in the database administrators guide, and I thing the utilities guide.
Similar Messages
-
firefox 13.0.1 on windows xp
the window is always maximized - no possibility to resize anymore - restore down minimizes the window - also tried from command line and height.. window appears but immediately minimizes
any idea ?Try:
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
*https://support.mozilla.org/kb/Troubleshooting+plugins
See also:
*http://kb.mozillazine.org/Corrupt_localstore.rdf
You can check for problems caused by a recent Flash 11.3 update and possibly downgrade to Flash 11.2 or 10.3.
*https://support.mozilla.org/kb/flash-113-doesnt-load-video-firefox
*https://support.mozilla.org/kb/flash-113-crashes
*http://blogs.adobe.com/asset/2012/06/inside-flash-player-protected-mode-for-firefox.html -
Problem while restoring backup from the pc to the ...
hi all
today i make two backups of my phone ( nokia XpressMusic 5730 Symbiyan 60 3rd) and then i restore all original phone settings using *#7370#
after that i tried to recover the back up from the pc
but after it finished restoring the backup and the mobile restarted nothing is back !
please help it is very important data
im using Nokia Pc Suite 7.1.180.94
my computer works on windows 7 ultimate service pack 1
and the backup is .nbu filethe backup content msgs and notes and calender
-
Problem during restore from a file
Hello guys,
I'have a big problem during restore a backup, the situation :
I want to upgrade my iPhone from 4.0.2 to 4.3.3
I make a encrypted backup (I know password ...) of the old version -> ok no errors
I upgrade iOS -> ok
When I want to restore the version I ve just backup -> it crashs : iphone restart and error appears "the Iphone was disconnected" ... (it works fine with an older backup of december 2010 ...)
I try to unistall / reinstall iTunes, it's the last version -> same problem
I try one a another machine (Windows 7 and XP) -> same problem
The logs :
[4896 @ Mon Jun 20 22:33:02 2011] [com.apple.console AppleMobileBackup.exe] Unable to move temporary file "C:\Users\***\AppData\Roaming\Apple Computer\MobileSync\Backup\Logs\MobileBackup-unknown-20110620-223302-Restore-Co mputer.log" (3)
[4896 @ Mon Jun 20 22:33:02 2011] [com.apple.console AppleMobileBackup.exe] Unable to move temporary file "C:\Users\Hamad\AppData\Roaming\Apple Computer\MobileSync\Backup\Logs\MobileBackup-10b66065f7dbf1da28658fd7fbeb7b128a 871760-20110620-223302-Restore-Computer.log" (3)
[4896 @ Mon Jun 20 22:33:02 2011] [com.apple.console AppleMobileBackup.exe] WARNING: Restoring 10b66065f7dbf1da28658fd7fbeb7b128a871760 from 10b66065f7dbf1da28658fd7fbeb7b128a871760-20110619-224423
[5564 @ Mon Jun 20 22:34:09 2011] [(unknown facility) iTunes.exe] AMDServiceConnectionReceiveMessage (thread 3352): Could not receive size of message: 0 No error
[5564 @ Mon Jun 20 22:34:09 2011] [(unknown facility) iTunes.exe] _read_thread (thread 3352): Could not receive message: 0xe8000001
[4896 @ Mon Jun 20 22:34:10 2011] [com.apple.console AppleMobileBackup.exe] ERROR: Connection to device lost (com.apple.MobileBackup.ErrorDomain/200)
[4896 @ Mon Jun 20 22:34:10 2011] [com.apple.console AppleMobileBackup.exe] ERROR: Restore error: -10
I want to restore at least my contacts, sms and photos, the issue was the backup is encrypted that why I cant't acceess directly to the concerned files ...
Can somebody help me?
ThanksHello, I had the same problem with my notebook (HP Envy 15) and iTunes 10.5 after install iOS 5. The restore backup fail and show the next text:
[4428 @ Mon Oct 17 00:44:41 2011] [com.apple.console AppleMobileBackup.exe] Unable to move temporary file "C:\Users\Dani\AppData\Roaming\Apple Computer\MobileSync\Backup\Logs\MobileBackup-unknown-20111017-004441-Restore-Co mputer.log" (2)
[4428 @ Mon Oct 17 00:44:41 2011] [com.apple.console AppleMobileBackup.exe] Unable to move temporary file "C:\Users\Dani\AppData\Roaming\Apple Computer\MobileSync\Backup\Logs\MobileBackup-71f0bc4bbd4f76087135ff002d3b0c7f6b 85ee0f-20111017-004441-Restore-Computer.log" (2)
[4428 @ Mon Oct 17 00:44:41 2011] [com.apple.console AppleMobileBackup.exe] WARNING: Restoring 71f0bc4bbd4f76087135ff002d3b0c7f6b85ee0f from 71f0bc4bbd4f76087135ff002d3b0c7f6b85ee0f
[4428 @ Mon Oct 17 00:44:41 2011] [(unknown facility) AppleMobileBackup.exe] _AMDDeviceAttachedCallbackv3 (thread 3008): Device 'AMDevice 004EFAA8 {UDID = 71f0bc4bbd4f76087135ff002d3b0c7f6b85ee0f, device ID = 1, location ID = 0x0, product ID = 0x1297}' attached.
[4428 @ Mon Oct 17 00:45:08 2011] [(unknown facility) AppleMobileBackup.exe] lockssl_handshake (thread 3008): SSL handshake fatal lower level error -1: SSL_ERROR_SYSCALL errno (No such file or directory)
[4428 @ Mon Oct 17 00:45:08 2011] [(unknown facility) AppleMobileBackup.exe] AMDeviceStartSession (thread 3008): Could not start session: kAMDInvalidPairRecordError
[4428 @ Mon Oct 17 00:45:08 2011] [(unknown facility) AppleMobileBackup.exe] _AMDNotifyHook (thread 3008): Could not load library SHLWAPI.dll from the AppleMobileDeviceSupport directory, C:\Program Files (x86)\Common Files\Apple\Mobile Device Support\\SHLWAPI.dll.
[4428 @ Mon Oct 17 00:45:08 2011] [com.apple.console AppleMobileBackup.exe] ERROR: Error attaching to device
[4428 @ Mon Oct 17 00:45:08 2011] [YSLoader AppleMobileBackup.exe]
Without any doubt there's some problem with USB device during this operation of restore. After 5 hours looking for a solution, I copied the backup folder (C:\Users\Dani\AppData\Roaming\Apple Computer\MobileSync) to an external disk, installed iTunes in other PC, copy the backup and restore without any problem.
Regards -
We have implemented our own way of logshipping by backing up the transaction logs of all our non-system databases every hour. Then we transfer the backups (before SQL Server 2008 R2 with additional zip and unzip steps) to the second environment where we
restore them only during the night on databases in standby-state (Like this, our developers can access the databases without disturbing the productive system and we can restore the t-logs during night, so not shutting out the developers during the day).
Now since we replaced our hardware in the productive environment, we replaced the hardware in the second environment with the servers from previous productive environment. Same SQL Server 2008 R2, same Service Pack (SP2), same installation procedure. But
since then the SQL Server in the second environment behaves different:
- When the logs of some database "A" are restored, I cannot access the properties of any database, i.e. database "B", I only get the error message "Cannot show requested dialog. (SqlMgmt) Database 'A' cannot be opened. It is in the
middle of a restore. (Microsoft SQL Server, Error: 927)"
- Our logshipping runs multiple instance at the same time, so restoring multiple databases' logs. But since the change, two of the instances fail restoring of datatbases, i.e. "B" and "C" with the error message "Database 'A' cannot
be opened. It is in the middle of a restore.". The jobs guarantee to restore only logs of the database they need to restore, they have strictly separated sets of target databases and only try to restore the databases of their sets.
Before the new installations, we did not have these strange behaviours. But as said, it is the same SQL Server version, the same service pack, and we followed the same installation document but maybe with the small changes in settings. The user the jobs
are running under is a domain admin, the login they use has dbcreator, processadmin, db_owner and db_backupoperator roles. My login on the SQL Server has sysadmin rights and as described similar problems.
Is this problem known or does somebody have an idea where to go looking for?
Thanks, ChrisHi Christar,
According to your description, after you configuring Log shipping between two database, you remove the hardware from production environment to dev environment, in this hardware, there are saved the transaction logs of your database.
When restoring your database, there will occurs error 927, right?
SQL Server Log shipping allows you to automatically send transaction log backups from a
primary database on a primary server instance to one or more
secondary databases on separate secondary server instances. It consists of three operations:
1.Back up the transaction log at the primary server instance.
2.Copy the transaction log file to the secondary server instance.
3.Restore the log backup on the secondary server instance.
Since you want to move your hardware avoiding copy job, we need to verify if .mdf and .ldf file are not saved in your hardware, or else,
if you move your hardware, you could not open your database in your Primary Server. I recommend you can refer to the following steps.
Full back up your primary database and restore it into the secondary database. It would have been set up as WITH STANDBY ,the databases would read StandBy/ Read Only.
Perform transaction log backups via a SQL Server Agent job running on the primary server instance, save them in your hardware.
In night, you move hardware to your dev environment, you can manually restore these transaction log backups or set up a SQL Server Agent job to restoring them from your hardware.
There is detail about how to configure log shipping in SQL Server 2008R2 step by step, you can review it.
http://mostafaelmasry.wordpress.com/2013/01/02/log-shipping-in-sql-server-2008r2-step-by-step/
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
"Could not connect to the ConfigMgr site database" problem with SCCM
The scenario is:
- SCCM 2007 SP1 installed on one server
- SQL 2008 installed on the other server
- Console was also installed on the SCCM server.
Everything was working just fine for about three months. As of few days ago, out of nowhere, I cannot open the console at all, it gives me this error:
" The ConfigMgr console could not connect to the ConfigMgr site database. Verify that this computer has network connectivity to the SMS Provider computer and that your user account has Remote Activation permissions on both
the ConfigMgr site server and SMS Provider computers. For more information, see "How to Configure DCOM Permissions for Configuration Manager Console Connections" in ConfigMgr Help. "
I confirmed all permissions (DCOM) and group settings (SMS Admin) and everything looks fine. I also noticed one other thing and I have a feeling its related - I log on to SCCM server and then from there I try to start RDP
connection to SQL server. I can connect, but as soon as I move the mouse or try clicking somewhere it breaks the connection and the "Trying to re-connect" window appears. It can`t establish normal RDP connection. If I try from any other server to SQL, it works
fine...
Any suggestions will be appreciated.
Dinolooks like I celebrated way too early - after working for about 20 minutes, it started throwing the same error again. Th adminUI log has this entry:
===========================================================================================================0
[3][13.4.2011 13:33:45] :Error returned from WMI Query Engine\r\nMicrosoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryException\r\nThe ConfigMgr Provider reported an error connecting to the ConfigMgr site database server. Verify
that the SQL Server is online and that ConfigMgr site server computer account is an administrator on the ConfigMgr site database server.\r\n at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryResultsObject.<GetEnumerator>d__0.MoveNext()
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryProcessor.ProcessQueryWorker(AsyncOperationDatabase asyncData)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)\r\nConfigMgr Error Object:
instance of SMS_ExtendedStatus
CauseInfo = "";
Description = "Unable to get SQL connection.";
ErrorCode = 3242263810;
File = "e:\\nts_sms_fre\\sms\\siteserver\\sdk_provider\\smsprov\\sspobjectquery.cpp";
Line = 1861;
Operation = "ExecQuery";
ParameterInfo = "select * from SMS_ConfigurationBaselineInfo where UPPER(CI_UniqueID) NOT IN (SELECT UPPER(InstanceKey) FROM SMS_ObjectContainerItem WHERE ObjectType=2011) ORDER BY LocalizedDisplayName";
ProviderName = "WinMgmt";
SQLMessage = "[08S01][11][Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.";
SQLSeverity = 0;
SQLStatus = 11;
StatusCode = 2147749889;
Unable to get SQL connection.
\r\nSystem.Management.ManagementException\r\nGeneric failure \r\n at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryResultsObject.<GetEnumerator>d__0.MoveNext()\r\nManagementException details:
instance of SMS_ExtendedStatus
CauseInfo = "";
Description = "Unable to get SQL connection.";
ErrorCode = 3242263810;
File = "e:\\nts_sms_fre\\sms\\siteserver\\sdk_provider\\smsprov\\sspobjectquery.cpp";
Line = 1861;
Operation = "ExecQuery";
ParameterInfo = "select * from SMS_ConfigurationBaselineInfo where UPPER(CI_UniqueID) NOT IN (SELECT UPPER(InstanceKey) FROM SMS_ObjectContainerItem WHERE ObjectType=2011) ORDER BY LocalizedDisplayName";
ProviderName = "WinMgmt";
SQLMessage = "[08S01][11][Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.";
SQLSeverity = 0;
SQLStatus = 11;
StatusCode = 2147749889;
\r\n
====================================================================================================
As I mentioned in my first post, the RDP from SCCM to SQL servers is not working and I think that is related to my problem....suggestions? -
Server cleanup wizard problem - unable to connect to the WSUS Server Database.
I'm trying to run server cleanup wizard.. it starts to run and then after a while it gives me this error:
The WSUS administration console was unable to connect to the WSUS Server Database.
Verify that SQL server is running on the WSUS Server. If the problem persists, try restarting SQL.
System.Data.SqlClient.SqlException -- Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.
Source
.Net SqlClient Data Provider
Stack Trace:
at Microsoft.UpdateServices.Internal.BaseApi.SoapExceptionProcessor.DeserializeAndThrow(SoapException soapException)
at Microsoft.UpdateServices.Internal.DatabaseAccess.AdminDataAccessProxy.ExecuteSPSearchUpdates(String updateScopeXml, String preferredCulture, ExtendedPublicationState publicationState)
at Microsoft.UpdateServices.Internal.BaseApi.Update.SearchUpdates(UpdateScope searchScope, ExtendedPublicationState publicationState, UpdateServer updateServer)
at Microsoft.UpdateServices.Internal.BaseApi.UpdateServer.GetUpdates(UpdateScope searchScope)
at Microsoft.UpdateServices.UI.AdminApiAccess.UpdateManager.GetUpdates(ExtendedUpdateScope filter)
at Microsoft.UpdateServices.UI.AdminApiAccess.WsusSynchronizationInfo.InitializeDerivedProperties()
at Microsoft.UpdateServices.UI.AdminApiAccess.WsusSynchronizationInfo.get_NewUpdatesCount()
at Microsoft.UpdateServices.UI.SnapIn.Pages.SyncResultsListPage.GetSyncInfoRow(WsusSynchronizationInfo syncInfo)
at Microsoft.UpdateServices.UI.SnapIn.Pages.SyncResultsListPage.GetListRows()
ThanksSome questions:
Are there any other databases running on this Std Edition SQL service?
[a] Yes there are, we have Kaspersky enterprise DB, Report Server DB and local application DB.
Are there any other services running on this WSUS Server?
[b] Yes there are, we have Active Directory, Kaspersky enterprise, SQL Server 2005, and WSUS all on the same server.
How many days since your WSUS server was first installed?
[c] It's been about a year now.
What is the physical size of the SUSDB.mdf file?
[d] 9,666,752 KB
What is the hardware configuration of this machine, including disk drives?
[e] Intel Xeon 1.86, 2GB Ram, HD C: 39GB - E: 25.2, running Windows Server 2003 R2 SP2.
How many client systems are you servicing from this WSUS Server?
[f] Around 40.
What products/classifications are you synchronizing.
[g] Windows XP-vista, Windows Server 2003, Office 2003-2007, SQL Server 2005.
Okay, for starters, you have an underpowered/overextended machine running Active Directory, ASP.NET, and a database server, all on a sub 2GHz CPU with 2GB RAM, and not enough disk spindles. The machine has had WSUS running for about a year and is 9GB in size.
There's no doubt in my mind that some of your performance issues are directly related to disk and database fragmentation.
There's also no doubt that some of your performance issues are directly related to memory starvation.
I'd suggest the following long-term fixes:
1. Get a second machine. Make it a dedicated database server. Provision it accordingly to support servicing multiple database applications.
2. Lacking #1, this machine needs more memory. It also needs more disk spindles. At a minimum the databases being serviced should be on a dedicated physical drive; ideally there would be two dedicated drives allocated for supporting database services. The
For the short-term fixes, do this:
1. During after-hours time, if you don't already have one, build a temporary machine that can act as a DC/GC, while you take this machine temporarily offline.
1. Shutdown the Update Services service, SQL Server database engine, and any other services dependent on the SQL Server database engine (Kapersky, and other reporting applications). Disconnect from the network to temporarly eliminate DC traffic. (You could also shutdown the AD services, but disconnecting the network cable is ever-so-much easier.) Defragment ALL drives.
2. Restart ONLY the SQL Server service. Obtain this SQL script to Reindex the WSUS Databases.
3. Restart ONLY the Update Services service. Attempt the Server Cleanup Wizard again. Run it in two passes. Pass 1 performing everything except remove unused updates. Pass 2 running only remove unused updates.
4. After completion of the Server Cleanup Wizard, reconnect the machine to the network and resume all other services.
5. If you're able to complete #3, secure the services of a well-qualified DBA to determine if there are any misconfigurations in your SQL Server setup that would account for why your WSUS database is 9GB in size -- such as improperly configured autogrowth parameters. Based on the products you're updating and only forty clients, 9GB is about 3x the maximum size I would expect to see in a WSUS database. It's possible this is simply caused by excess unused updates, it's possible it's caused by fragmentation, it's probable it was caused by unnecessary autogrowth of the database due to insufficient update maintenance. You'll want a DBA to assist you in shrinking that database after you successfully run the Database Maintenance and Server Cleanup Wizard.
Lawrence Garvin, M.S., MCITP(x2), MCTS(x5), MCP(x7), MCBMSP
Principal/CTO, Onsite Technology Solutions, Houston, Texas
Microsoft MVP - Software Distribution (2005-2009) -
How to restore the oracle 10g database
Hi all,
I am very new to oracle. I have experience in mssql and mysql previously.
Now we have a oracle application to work . I have an oracle database backup (mydata.bak) taken it from my client's oracle database 10g enterprise edition. Now I want to restore the .bak file at my place . I had installed oracle 10g enterprise edition. After that I had created a datbase called praveen by selecting archivelogmode. The database had created . I am able to login through enterprise manager for this praveen database instance.
Now I want to restore the backup file mydata.bak file into praveen database. May I know how to proceed further?
Please anybody help me out?
And basically what is the backup file format in oracle . As I know for mysql it is .sql and for MSsql it is .bak.
Plz buddies anybody help me out. It is very urgentHi..
Actually one of the employee related to my client had given me the backup file (mydata.bak). I don't know exactly which type it is?Can't you contact the concerned person at the client side.
May I know what is the difference between rman and cold backup?In cold backup the database is first cleanly shutdown, and then copies of all the datafiles of the database are taken(all of them in consistent stage).
RMAN backup is used more where you need to take the backup while the database is up and running.If the database is in ARCHIVELOG mode, then the RMAN backup can be taken while database is in open mode and if the database is in NOARCHIVELOG mode, then in mount stage.
[http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/part1.htm]
[http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/part4.htm#BRADV44444]
Can I start restore by assuming the given backup file as cold and if is not possible by assuming cold backup? Better confirm and then start.
Anand -
Problem trying to log in the database
Hi im new using oralce i just had installed it in a P4 3.0Ghz 2GB Ram Windows XP SP3.
And when i try to login i got this error:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not existHi,
As you have said, you have installed the oracle. Does you have create the database during the installation or you have done only installation of oracle. If you have done only installation of oracle software then you need to create a database. If you have create the DB, with out any issues then with respect to the following error which you have posted then can couple reasons for that.
You can get the information if you google it any how the following are the reasons for that.
ORA-01034 "ORACLE not available"
Cause: Oracle was not started up. Possible causes include the
following:
- The SGA requires more space than was allocated for it.
- The operating-system variable pointing to the instance
is improperly defined.
Action: Refer to accompanying messages for possible causes and correct the problem mentioned in the other messages. If Oracle has been initialized, then on some operating systems, verify that Oracle was linked correctly. See
the platform specific Oracle documentation.
Try to go through the ORACLE Documentation, you can resolve your issue with out any concerns.
- Pavan Kumar N -
Problem with displaying the data from Database on swf file.
Hi ,
I am new to flash.Thanks in Advance Please help me....
Actually my requirement is my application consists a button(submit_Btn) when we click on the button(submit_Btn), each time it must to database(through servlet) and brings the data from database and places it on the flash swf file.Here my problem is for the first time when we click on the button it goes to database and place the data(which was returned from database) on the swf file.Next when we click on the button for the second time(or anytime) it is not going and bringing the new data from database(if some data is modified in database or not),Infact it is showing the old data(the data that was collected from previous ClickListener) only on the swf file and it is also not showing any complile time or run time error.
my Code looks like this:
submit_Btn.addEventListener(MouseEvent.CLICK,onCheck2);
function onCheck2(evnt:MouseEvent):void {
var xmlLoader:URLLoader = new URLLoader();
var xmlurl:String = "http://localhost:8888/xmlServlet";
var xmlrequest:URLRequest = new URLRequest(xmlurl);
xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
xmlLoader.addEventListener(Event.COMPLETE, xmlcompleteHandler);
xmlLoader.load(xmlrequest);
function xmlcompleteHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
var succData:String=loader.data;
var xmlData:XML = new XML();
var xmlList:XMLList;
xmlData = XML(loader.data);
xmlList = xmlData.children();
for (var i=0; i<xmlList.length(); i++) {
for (var n=0; n<xmlData.UserHumanap[i].HumanapDot.length(); n++) {
var x_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@x;
var y_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@y;
var point2:Point = new Point(x_coordinate,y_coordinate);
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0x00ff00);
circle.graphics.drawCircle(point2.x,point2.y,3); //Placing the data as dots on the swf file
Thanks in Advance.......Please Help me..........
its Urgent..........
Thanks,
SwarthiCheckout following line in your code
var xmlurl:String = "http://localhost:8888/xmlServlet";
now change it to
var xmlurl:String = "http://localhost:8888/xmlServlet?random="+String(MAth.random());
I think you will get the point now -
Can CDC enabled database DIFF backups be RESTORED while maintaining the CDC integrity?
We tried restoring FULL + subsequent DIFF backups of a CDC enabled database to a different SQL server and found that the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
Can someone please guide us on how to successfully restore the CDC enabled database backups(FULL + DIFF) while maintaining the CDC integrity?
Note: SQL Server Version: SQL Server 2012 SP1 CU2Hi YoungBreeze,
Based on your description, I make a test on my computer.
Firstly, I create a database named ‘sqldbpool’ , then enable the
Change Data Capture (CDC) feature and take full+ differential backups of the database. Below are the scripts I used.
-- Create database sqldbpool
CREATE DATABASE [sqldbpool] ON PRIMARY
( NAME = N'SQLDBPool', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SQLDBPool.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'SQLDBPool_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SQLDBPool_log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use sqldbpool;
go
-- creating table
create table Customer
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
--Enabling CDC on SQLDBPool database
USE SQLDBPool
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE SQLDBPool
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('jugal'),('shah')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database sqldbpool to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\sqldbpool.bak'
insert into Customer values('111'),('222')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE sqldbpool TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\sqldbpooldif.bak' WITH DIFFERENTIAL
GO
Secondly, I restore the ‘sqldbpool’ database in a different SQL Server instance with the following scripts. After the restoration, everything works as expected and the database maintains the CDC integrity.
Use master
Go
--restore full database backup
restore database sqldbpool from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\sqldbpool.bak' with keep_cdc
Restore Database sqldbpool From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\sqldbpool.bak'
With Move 'SQLDBPool' To 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SQLDBPool.mdf',
Move 'SQLDBPool_log' To 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\SQLDBPool_log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database sqldbpool from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\sqldbpooldif.bak' with keep_cdc
--add the Capture and Cleanup jobs
Use sqldbpool
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
When we restore a CDC enabled database, we need to note that the CDC feature is available only on the Enterprise, Developer, and Evaluation editions of SQL Server. And we need to add the Capture and Cleanup agent jobs after restoring the database.
For more details about restoring a CDC enabled database in SQL Server, you can review the following similar articles.
Restoring a SQL Server database that uses Change Data Capture:
http://www.mssqltips.com/sqlservertip/2421/restoring-a-sql-server-database-that-uses-change-data-capture/
CDC Interoperability with Mirroring and Recovery:
http://www.sqlsoldier.com/wp/sqlserver/cdcinteroperabilitywithmirroringandrecovery
Thanks,
Lydia Zhang -
Question
Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
Answer
When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs.
In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
-- Create database CDCTest
CREATE DATABASE [CDCTest] ON PRIMARY
( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use CDCTest;
go
-- creating table
create table Customer
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
--Enabling CDC on CDCTest database
USE CDCTest
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE CDCTest
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('Mike'),('Linda')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
insert into Customer values('David'),('Jane')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
GO
Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
Use master
Go
--restore full database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
Restore Diff backup of the ‘CDCTest’ database.
Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
Add the Capture and Cleanup jobs in the CDCTest database.
--add the Capture and Cleanup jobs
Use CDCTest
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
Reference
Track Data Changes (SQL Server)
Restoring a SQL Server database that uses Change Data Capture
Applies to
SQL Server 2014
SQL Server 2012
SQL Server 2008 R2
SQL Server 2008
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Question
Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
Answer
When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs.
In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
-- Create database CDCTest
CREATE DATABASE [CDCTest] ON PRIMARY
( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use CDCTest;
go
-- creating table
create table Customer
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
--Enabling CDC on CDCTest database
USE CDCTest
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE CDCTest
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('Mike'),('Linda')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
insert into Customer values('David'),('Jane')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
GO
Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
Use master
Go
--restore full database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
Restore Diff backup of the ‘CDCTest’ database.
Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
Add the Capture and Cleanup jobs in the CDCTest database.
--add the Capture and Cleanup jobs
Use CDCTest
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
Reference
Track Data Changes (SQL Server)
Restoring a SQL Server database that uses Change Data Capture
Applies to
SQL Server 2014
SQL Server 2012
SQL Server 2008 R2
SQL Server 2008
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread. -
Problem in printing the data from database when i print inside servlet
hi to all!
the objective of the code below is getting the data from database table and has to send that data to the web browser using out.println .note: out - PrintWriter object
In a getQuestion method, i am getting the data from database table and store it in String q and when i print the q within this method it is getting printed, but i got the null value when i printed the String q inside service method doPost. why..? its puzzling me.
package servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test extends HttpServlet {
Connection con;
ResultSet rs;
Statement s;
StringBuffer q;
StringBuffer o1;
StringBuffer o2;
StringBuffer o3;
public void getQuestion() throws Exception
if(rs.next())
q=new StringBuffer(rs.getString("question"));
o1=new StringBuffer(rs.getString("option1"));
o2=new StringBuffer(rs.getString("option2"));
o3=new StringBuffer(rs.getString("option3"));
System.out.println(q);
System.out.println(o1);
System.out.println(o2);
System.out.println(o3);
public void connect(){
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select * from qa order by newid()");
getQuestion();
catch(Exception e)
System.out.println("erroe");
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
response.setContentType("text/html");
new test().connect();
PrintWriter out=response.getWriter();
request.setAttribute("question", q);
request.setAttribute("option1", o1);
request.setAttribute("option2", o2);
request.setAttribute("option3", o3);
//RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
//rd.forward(request, response);
out.println("<html>");
out.println("<head>");
out.println("<title>" + "shock!!!" + "</title>");
out.println("</head>");
out.println("<body>");
out.println("<h2>"+"Read twice before u answer"+"<h2>");
out.println("<p></p>");
//why the value of q is not getting printed, instead i get null
out.println("<h2>"+ q +"<h2>");
out.println("how is it");
out.println("</body>");
out.println("</html>");
Edited by: Mahesh_yeswecan on Nov 29, 2008 10:42 AMAs u said , i have done a silly mistake earlier. though i have corrected the code still i am getting the same null value
package servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test extends HttpServlet {
Connection con;
ResultSet rs;
Statement s;
StringBuffer q;
StringBuffer o1;
StringBuffer o2;
StringBuffer o3;
public void getQuestion() throws Exception
if(rs.next())
q=new StringBuffer(rs.getString("question"));
o1=new StringBuffer(rs.getString("option1"));
o2=new StringBuffer(rs.getString("option2"));
o3=new StringBuffer(rs.getString("option3"));
System.out.println(q);
System.out.println(o1);
System.out.println(o2);
System.out.println(o3);
public void connect(){
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select * from qa order by newid()");
getQuestion();
catch(Exception e)
System.out.println("erroe");
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
response.setContentType("text/html");
connect();
PrintWriter out=response.getWriter();
request.setAttribute("question", q);
request.setAttribute("option1", o1);
request.setAttribute("option2", o2);
request.setAttribute("option3", o3);
//RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
//rd.forward(request, response);
out.println("<html>");
out.println("<head>");
out.println("<title>" + "shock!!!" + "</title>");
out.println("</head>");
out.println("<body>");
out.println("<h2>"+"Read twice before u answer"+"<h2>");
out.println("<p></p>");
//why the value of q is not getting printed, instead i get null
out.println("<h2>"+ q +"<h2>");
out.println("how is it");
out.println("</body>");
out.println("</html>");
} -
Is this supposed to be the most reliable database server? A msg to oracle.
Hi, it's been 3 weeks now that I'm fiddling with oracle 11g and I am surprised with the amount of installation/startup/shutdown/management issues that I am facing. I need to evaluate oracle as a possible replacement for sql server, I am supposed to test oracle's scalability vs sql server scalability but so far I was messed up by all kind of installation/management issues. Is Oracle a product always in alpha stage?
I am not new with oracle, I've used oracle 10g in the past and I went through all the oracle library documentation (concepts, dba guide, sql reference etc). By now I am pretty confident with db concepts like control files, redo logs, spfile, tablespaces etc.
I've installed it on 4 machines:
1. windows xp 64bit, 40GB Ram
installation went ok, database + listener + dbconsole started correctly. I did a few things but after rebooting the machine the db did not start! (it complained that it tried to allocate 0 bytes of memory where it needed 2mb for some reason).
dbca is supposed to configure an instance but guess what? To configure the instance if first must start the instance and ofcourse in my case it couldn't start the instance!!!
After reading docs, googling etc, I exported spfile to pfile , manually edited the pfile, imported the pfile as spfile and the db finally started working.
Why on earth a product costing so much can't survive a reboot?
2. centos 5.3 64bit on a P4 machine with 2gb ram
installed ok, database + listener + dbconsole started ok after install. There is no script that I am aware which starts or shuts down the db nor the installer prompted me to install the db as a service (/etc/init.d). So I manually had to create scripts to start/shutdown the db by exporting ORACLE_HOME, ORACLE_SID and using dbstart.sh and dbshut.sh and also calling emctrl start dbconsole.
Which means that if someone doesn't shut down the instance before rebooting linux, will the db shut down abnormally?
I would expect a product that costs £13k to install itself properly on linux. mysql is free but comes with proper installations in most linux flavors.
3. centos 5.3, 64bit on an athlon 64 3000+ with 1gb ram.
installed ok, database + listener + dbconsole started ok after install. As you can guess, it didn't survive a reboot. Anyway to make long story short, I managed to create startup/shutdown scripts and all started working.
Then I tried to play admin for a while, i.e. tried to move tablespaces, backup/restore db, backup tablespaces and so on, using dbconsole. Oh well, I can't count the times dbconsole was failing... Are we the beta testers of dbconsole?
But then I needed to change the domain name of the machine and bang! All db services broken again. After fiddling with listener.ora and other config files that I don't remember, I managed to make db and listener work again but not the dbconsole which doesn't want to start and also I don't know where are the log files (there are so many log folders....) Anyway I am still digging into the documentation.
4. fedora 9 32 bit, 2gb ram. Same issues like #2,#3.
I've the following suggestions for oracle:
1. Less configuration files for oracle's next version.
2. Installation should "do it all" for the user in all operating systems
3. a dedicated testing team for dbconsole - it's just buggy
4. improvements on db,tablespace backups and movements. Is it so hard to create a utility that create a zipped backup of tablespaces or the database which can be used on a different server to restore the files?
I've still not worked on my main task : to test scalability. More comments will follow...
Regards,
KostasHi, found the log file, it is under .../dbhome_1/oc4j/j2ee/OC4J_DBConsole_server.lan_orcl/log
It appears that oc4j was trying to load the encryption keys file from OC4J_DBConsole_localhost_orcl, didn't find it, oc4j was then exiting but emctl was constantly trying to restart oc4j!!! One more cool "feature" of oracle.
Anyway, I managed to fix that issue but now oc4j/dbconsole still doesn't start, dunno why, the log says:
<MESSAGE>
<HEADER>
<TSTZ_ORIGINATING>2010-01-07T21:35:39.517+00:00</TSTZ_ORIGINATING>
<COMPONENT_ID>oc4j</COMPONENT_ID>
<MSG_TYPE TYPE="WARNING"></MSG_TYPE>
<MSG_LEVEL>1</MSG_LEVEL>
<HOST_ID>server.lan</HOST_ID>
<HOST_NWADDR>192.168.1.4</HOST_NWADDR>
<MODULE_ID>network</MODULE_ID>
<THREAD_ID>13</THREAD_ID>
<USER_ID>ariskk</USER_ID>
</HEADER>
<CORRELATION_DATA>
<EXEC_CONTEXT_ID><UNIQUE_ID>192.168.1.4:94967:1262900139517:43</UNIQUE_ID><SEQ>0</SEQ></EXEC_CONTEXT_ID>
</CORRELATION_DATA>
<PAYLOAD>
<MSG_TEXT>Exception in NIOServerSocketDriver:selectForRead</MSG_TEXT>
<SUPPL_DETAIL><![CDATA[java.nio.channels.ClosedChannelException
at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:252)
at oracle.oc4j.network.NIOServerSocketDriver$SelectorThreadTask.selectForRead(NIOServerSocketDriver.java:331)
at oracle.oc4j.network.NIOServerSocketDriver.selectForRead(NIOServerSocketDriver.java:58)
at oracle.oc4j.network.ServerSocketAcceptHandler.persistConnection(ServerSocketAcceptHandler.java:389)
at oracle.oc4j.network.ServerSocketAcceptHandler.endReadHandlerRun(ServerSocketAcceptHandler.java:409)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:275)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
]]></SUPPL_DETAIL>
</PAYLOAD>
</MESSAGE>
I also got an other problem. I have a heap table and I've created the same table as index organized. I am trying to copy the data over :
insert into header2 select * from header nologging;
But after around 5000 secs, sql developer gives me this error:
SEVERE 117 1314807 java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:246)
and the dml stops running. I've run that 3-4 times and it fails from 4800 to 5200 secs so I recon a time out is in place, any idea how to remove this timeout? -
Have a error in getting the values from database randomly
Hi to all
I am new member to this community and new to java programming, i am the one of them who got benefited through this site , with that hope i am asking u to clear my doubt.
Actually i want to get the data from database randomly, i dont have problem either in database connection and generating random number,its working fine. but when i have to get the data from database with generated random no using absolute function , i am getting an exception
eg : rs.absolute(2);
i could not move to the second row of my result set.
not only absolute function whatever the function i am using except next method, getting exception.
my code :
package practical;
import java.util.*;
import java.sql.*;
public class gen {
Connection con;
Statement s;
ResultSet rs;
public void get(int t)
try
rs.absolute(t);
String question=rs.getString("question");
System.out.println("Random question : "+question);
catch(Exception e)
System.out.println("get error");
public void ran()
Random r=new Random();
for(int i=0;i<10;i++)
int j=r.nextInt(10);
System.out.println("random value : "+j);
if(j!=0)
try
get(j);
catch(Exception e)
System.out.println("ran error");
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select question from qa");
ran();
con.close();
catch(Exception e)
System.out.println("error");
public static void main(String... strins)
new gen().connect();
}but i acheived through the code which is pasted below but i have to close the database connection for every iteration.
package practical;
import java.util.*;
import java.sql.*;
public class gen {
Connection con;
Statement s;
ResultSet rs;
public void get(int t)
int c=0;
while(c!=t)
try
rs.next();
c++;
catch(Exception e)
System.out.println("next error");
if(c==t)
{ try
String question=rs.getString("question");
System.out.println("Random question : "+question);
catch(Exception e)
System.out.println("iteration error");
public void ran()
Random r=new Random();
int j=r.nextInt(10);
System.out.println("random value : "+j);
if(j!=0)
try
get(j);
catch(Exception e)
System.out.println("ran error");
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
s=con.createStatement();
rs=s.executeQuery("select question from qa");
ran();
con.close();
catch(Exception e)
System.out.println("error");
public static void main(String... strins)
for(int i=0;i<10;i++)
new gen().connect();
}
Maybe you are looking for
-
Dynamic cluster/array follow up question - front panel
Thanks for the responses to my last question - they were great and fast! I'm still stumped on how to create the front panel. It doesn't really matter whether it is an array or cluster. It sounds like either way, once I have it I can autoindex through
-
I'm running itunes 11.0.3 - in my iTunes library I can no longer see purchased TV shows and Movies that are not downloaded to my computer. In my Itunes account i have no hidden TV shows or Movies I used to be able to view all cloud and downloaded con
-
Loading data from one table to another using cursor
Hi, I have given the below command to load the data from 1 table to another using cursor. declare cursor mycursor IS SELECT extract_name,from_date,to_date,BETA from temp_table where EXTRACT_NAME='GIFTCARD_DETAILS'; Begin for mycursor_1 IN mycursor lo
-
Wrong User name or Password while connecting from SAP Business One - PL26
I have restored my database on the server.I am using Patch Level PL26 I am getting an error while logging to Server Wrong username and password....Message [131-93] Is it because i have not imported the Temporary Liscence.But when i work on my laptop,
-
How to get my phones out of headphone mode
It's stuck in headphone mode and I can't listen to music or call anyone someone please help me