This article is second part of a two-part article for
programmers who want to start writing socket programs with
VB.
In previous part of this article we saw how we can write a
simple hello server in VB. We used a socket object that
comes with VB for this purpose. Mswnsock.ocx is a very
stable socket object that we used in our program.
This example uses Winsock component again. You will need a
form with a command button (command1), a socket component
(winsock1) and a list box (list1) in this example.
We will need to do the following steps to have our hello
client connect to our server and communicate with it.
1- This time we don't need to bind anything.
2- when we press connect key (command1) socket starts
connecting to a server via TCP/IP network. Connect function
needs two parameters before it can connect to a server.
IP address specifies the host that server is running on it.
As we want the client to connect server program running on
our own server we use loop back address that points to our
computer. Loop back address is �127.0.0.1�. You can use
address of any other host instead of this.
Second parameter is TCP port. As you know can assign a port
number between 1 and above 65000 to each clinet/server
application.
This is TCP channel we use to avoid communication conflicts
between different programs that communicate between two
hosts. We chose an optional port number of 1024.
3- When a client socket opens a connection to server program,
a connect event is triggered on client program. When we
receive this event we start sending data to server and
also simultaneously show it in listbox1. Message sent to
server is "hi!"
4- After server has finished receiving sent data, it sends
back answer data that is 멻ello� string. It will close
connection after it has sent its data. So closing
connections is done by server side.
5- If any error occurs on socket an 'onerror' event is
triggered. In this case we will display an error message.
And now program source:
Private Sub Command1_Click()
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Connect "127.0.0.1", 1024
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "Hi!" + vbCrLf
List1.AddItem "Sent to Server: Hi!"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData a$, vbString
List1.AddItem "Received from server: " + a$
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer,
Description As String, ByVal Scode As Long,
ByVal Source As String, ByVal HelpFile As String,
ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "Error in socket : " + Description, vbOKOnly
End Sub
If you need codes for this article you can visit our site
and go to ezine page. There you will find a link to zip
source files.
http://op.htmsoft.com/ezines.html
http://op.htmsoft.com/articles/Articlea2-1-2.html
'Develop > VB6' 카테고리의 다른 글
Small TCP/IP Hello server with VB 6.0 (0) | 2013.04.08 |
---|
This article is first part of a two part article for people |
'Develop > VB6' 카테고리의 다른 글
Small TCP/IP Hello Client Software with VB 6.0 (0) | 2013.04.08 |
---|
자료출처 : http://www.oracleclub.com/lecture/1847
COLD BACKUP(오프라인 백업)
Oracle 9i 이후 버전에서의 Cold 백업은 오라클클럽 백업&복구 강좌의 Cold 백업 강좌를 참고해 주세요
COLD BACKUP(오프라인 백업)
- COLD BACKUP이란 오라클 SHUTDOWN후 DATAFILE, REDO LOG FILE, CONTROL FILE, PARAMETER FILE등을 OS의 복사명령으로 백업을 수행하는 방법을 말한다.
- 백업받을 파일들의 목록은 V$DATAFILE, V$LOGFILE, V$CONTROLFILE에서 찾을 수 있다.
- COLD BACKUP을 위해서 데이타베이스를 SHUTDOWN 할 때에는 NORMAL, IMMEDIATE 옵션을 사용해야 하며 ABORT 를 사용해서는 안 된다. ABORT 를 사용한 경우에는 SHUTDOWN 후에 다시 STARTUP 하고 NORMAL 로 SHUTDOWN 하도록 한다.
- SHUTDOWN ABORT 옵션을 쓸 경우 Checkpoint 정보가 일치하지 않아 복구가 수행되지 않을 수 있으므로 이 옵션을 사용하지 말아야 한다.
- SHUTDOWN 하지 않고 OPEN 된 상태에서 백업을 받으면 백업받은 내용을 나중에 사용할 수가 없으므로 유의해야 한다.
- 콘트롤 화일과 데이타 화일 및 로그 화일의 위치를 확인하여 이들을 tar, cpio 등의 명령을 이용하여 백업 받도록 한다.
- NT 에서는 COPY 명령이나 탐색기를 이용해서 백업을 받으면 된다.
- 장점 : 읽기 일관성이 보장됨, 가장 간편하다.
- 단점 : 데이터베이스 SHUTDOWN이 필요하므로 백업받는 동안 데이터베이스를 사용할 수 없으며, 백업이 수행된 시점까지만 복구가 가능하다
파일확인 방법
오라클은 반드시 SHUTDOWN된 상태이어야 하며, 아래에서 확인한 세 종류의 파일들을 OS명령어(ex cp)로 백업받으면 된다.
필요에 따라서 파라미터(init
-- Oracle 8.1.7 sqlplus에서 system/manager로 접속 -- 콘트롤 파일 확인 SQL> SELECT name FROM V$CONTROLFILE; NAME ------------------------------------------ C:\ORACLE\ORADATA\ORACLE\CONTROL01.CTL C:\ORACLE\ORADATA\ORACLE\CONTROL02.CTL C:\ORACLE\ORADATA\ORACLE\CONTROL03.CTL -- 데이타 파일 확인 SQL> SELECT name FROM V$DATAFILE; NAME -------------------------------------------------- C:\ORACLE\ORADATA\ORACLE\SYSTEM01.DBF C:\ORACLE\ORADATA\ORACLE\INDX01.DBF C:\ORACLE\ORADATA\ORACLE\TOOLS01.DBF C:\ORACLE\ORADATA\ORACLE\USERS01.DBF C:\ORACLE\ORADATA\ORACLE\STORM.DBF C:\ORACLE\ORADATA\ORACLE\STORMIDX.DBF C:\ORACLE\ORADATA\ORACLE\TEST.DBF -- 로그 파일 확인 SQL>SELECT member FROM V$LOGFILE; MEMBER ------------------------------------ C:\ORACLE\ORADATA\ORACLE\REDO03.LOG C:\ORACLE\ORADATA\ORACLE\REDO02.LOG C:\ORACLE\ORADATA\ORACLE\REDO01.LOG
오프라인 복구 예제
COLD BACKUP 백업에 대한 복구는 장애가 발생한 시점까지가 아니라, 가장 최근의 백업시점 까지만 복구가 가능 하며, 백업 시점에서 현 시점까지의 데이터는 모두 잃어 버리게 된다.
동일한 디스크에 위치한 데이터파일 복구
1. DB를 SHUTDOWN ABORT로 닫는다.
2. 백업해두었던 DATAFILE, REDO LOG FILE, CONTROL FILE, PARAMETER FILE(init.ora) 들을 현재의 DB 데이터파일들이 위치한 곳으로 이동 시킨다(copy 작업).
3. STARTUP MOUNT를 수행 한다.
4. ALTER DATABASE OPEN RESETLOS 수행
상이한 디스크에 위치한 데이터파일 복구
만일 디스크가 교체될 수 없는 경우, 파일들을 다른 디스크로 이동시켜 복구한다.
1. DB를 SHUTDOWN ABORT로 닫는다.
2. 백업해두었던 DATAFILE, REDO LOG FILE, CONTROL FILE, PARAMETER FILE(init.ora), PASSWORD FILD(orapwSID) 들을 다른 디스크로 이동
3. PARAMETER FILE에서 CONTROL_FILES 파라미터를 수정한다.
4. STARTUP MOUNT EXCLUSIVE 수행
5. 새로운 디스크에 위치한 데이터파일들의 위치를 control파일에 갱신
ALTER DATABASE RENAME FILE '/u01/oracle/data/data01.dbf' TO '/u02/oracle/data/data01.dbf'
6. DB백업(형식적인 절차)
7. ALTER DATABASE OPEN RESETLOGS 수행
문서에 대하여
- - 작성자 : 김정식 (oramaster _at_ naver.com)
- - 작성일 : 2004년 08월 17일
- - 강좌 URL : http://www.oracleclub.com/lecture/1847
- - 이 문서를 다른 블로그나 홈페이지에 게재하실 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- - 오라클클럽의 모든 강좌는 크리에이티브 커먼즈의 저작자표시-비영리-동일조건변경허락(BY-NC-SA) 라이선스에 따라 자유롭게 사용할 수 있습니다.