知识大全 Windows服务:方便地启动Oracle服务

Posted 系统

篇首语:一身转战三千里,一剑曾当百万师。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 Windows服务:方便地启动Oracle服务相关的知识,希望对你有一定的参考价值。

Windows服务:方便地启动Oracle服务  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

  Oracle i有多个系统服务必须都启动之后才能正常工作 但逐个启动比较费事 多数学习Oracle但机器又不是太好的朋友也不能容忍每次都自动启动Oracle服务(那样 MB的内存在启动时就所剩无几了) 所以通常都是要用了再启动 这里给出了批量启动windows系统服务的一个例子 介绍了操控windows系统服务的技巧 首先新建一个Windows Application工程 取名为Oracle Starter粘贴如下代码文件 Form Designer vb

Partial Public Class Form     Inherits System Windows Forms Form

  <System Diagnostics DebuggerNonUserCode()> _    Public Sub New()        MyBase New()

   This call is required by the Windows Form Designer         InitializeComponent()

  End Sub

   Form overrides dispose to clean up the ponent list     <System Diagnostics DebuggerNonUserCode()> _    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)        If disposing AndAlso ponents IsNot Nothing Then            ponents Dispose()        End If        MyBase Dispose(disposing)    End Sub

   Required by the Windows Form Designer    Private ponents As System ComponentModel IContainer

   NOTE: The following procedure is required by the Windows Form Designer    It can be modified using the Windows Form Designer       Do not modify it using the code editor     <System Diagnostics DebuggerStepThrough()> _    Private Sub InitializeComponent()        Me Label = New System Windows Forms Label        Me ListBox = New System Windows Forms ListBox        Me Button = New System Windows Forms Button        Me Button = New System Windows Forms Button        Me SuspendLayout()                Label                 Me Label AutoSize = True        Me Label Font = New System Drawing Font( Tahoma ! System Drawing FontStyle Bold System Drawing GraphicsUnit Point CType( Byte))        Me Label Location = New System Drawing Point( )        Me Label Name = Label         Me Label Size = New System Drawing Size( )        Me Label TabIndex =         Me Label Text = Oracle Starter                 ListBox                 Me ListBox Font = New System Drawing Font( Tahoma ! System Drawing FontStyle Regular System Drawing GraphicsUnit Point CType( Byte))        Me ListBox FormattingEnabled = True        Me ListBox ItemHeight =         Me ListBox Location = New System Drawing Point( )        Me ListBox Name = ListBox         Me ListBox Size = New System Drawing Size( )        Me ListBox TabIndex =                 Button                 Me Button Location = New System Drawing Point( )        Me Button Name = Button         Me Button Size = New System Drawing Size( )        Me Button TabIndex =         Me Button Text = Stop all services                 Button                 Me Button Location = New System Drawing Point( )        Me Button Name = Button         Me Button Size = New System Drawing Size( )        Me Button TabIndex =         Me Button Text = Start all servies                 Form                 Me AutoScaleBaseSize = New System Drawing Size( )        Me ClientSize = New System Drawing Size( )        Me Controls Add(Me Button )        Me Controls Add(Me Button )        Me Controls Add(Me ListBox )        Me Controls Add(Me Label )        Me Name = Form         Me Text = Oracle Starter         Me ResumeLayout(False)        Me PerformLayout()

  End Sub    Friend WithEvents Label As System Windows Forms Label    Friend WithEvents ListBox As System Windows Forms ListBox    Friend WithEvents Button As System Windows Forms Button    Friend WithEvents Button As System Windows Forms Button

  End Class

  Form vbImports System ServiceProcessImports System Threading

  Public Class Form

   Private procName As String    Private procArray( ) As String

  Private Sub Form _Activated(ByVal sender As Object ByVal e As System EventArgs) Handles Me Activated

  End Sub

  Private Sub Form _Load(ByVal sender As System Object ByVal e As System EventArgs) Handles MyBase Load        procArray( ) = OracleMTSRecoveryService         procArray( ) = OracleOraHome Agent         procArray( ) = OracleOraHome TNSListener         procArray( ) = OracleServiceSFSVDB         procArray( ) = OracleOraHome HTTPServer     End Sub

  Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click        Dim backThread As Thread        Dim i As Int         For i = To             backThread = New Thread(AddressOf procClass StopProc)            backThread IsBackground = True            procClass procName = procArray(i)            Label Text = Stopping service: + procClass procName +             Me Refresh()            backThread Start()            backThread Join()            ListBox Items Add( Service: + procClass procName + Stopped )            Me Refresh()            backThread = Nothing        Next        Label Text = All services stopped     End Sub

  Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click        Dim backThread As Thread        Dim i As Int         For i = To             backThread = New Thread(AddressOf procClass StartProc)            procClass procName = procArray(i)            Label Text = Starting service: + procClass procName +             Me Refresh()            backThread Start()            backThread Join()            ListBox Items Add( Service: + procClass procName + Started )            Me Refresh()            backThread = Nothing        Next        Label Text = All services started     End Sub

  Public Class procClass        Public Shared procName As String

  Public Shared Sub StopProc()            Dim servController As ServiceController = New ServiceController(procName)            If servController Status = ServiceControllerStatus Stopped Then            ElseIf servController Status = ServiceControllerStatus Paused Then                servController Stop()                servController WaitForStatus(ServiceControllerStatus Stopped)            ElseIf servController Status = ServiceControllerStatus Running Then                servController Stop()                servController WaitForStatus(ServiceControllerStatus Stopped)            End If        End Sub

cha138/Article/program/Oracle/201311/17456

相关参考

知识大全 在Windows系统下管理Oracle9i服务

在Windows系统下管理Oracle9i服务  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  在

知识大全 win2000不能自动启动oracle服务全攻略

  解决办法  ORADIM方法  确认控制面板的服务OracleStart<sid>已经启动确认服务的logintab中的登陆用户名和密码正确  检查数据库启动选项在DOS下执行  OR

知识大全 Linux下启动Oracle服务和监听程序

Linux下启动Oracle服务和监听程序  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  安装完

知识大全 windows优化系统后oracle9i本地连接失败

  我们使用的系统是windows经过优化后oracle数据库出现了问题本地客户端不能连接但远程连接是没有问题的    经过检查原来是oracle的TNSListener服务没有起动用服务起动或者ne

知识大全 操作无法完成,因为它无法及时启动远程访问连接管理器服务

我的win7系统无法连接网络,显示“错误711:操作无法完成,因为它无法及时启动远程访问连接管理器服务遇到此问题,Windows7用户可以参考以下方案进行解决:首先请确认相同网络环境下,其他计算机是否

知识大全 windows audio和plug and play一起停止服务,还有设备管理器里是一片空白,这该怎么办

windowsaudio和plugandplay一起停止服务,还有设备管理器里是一片空白,这该怎么办原因分析此情况一般为用户电脑中了病毒,杀毒后造成,或者关闭了某些服务。解决方案解法一:启动Pluga

知识大全 Windows下Oracle数据库进程的启动和关闭

Windows下Oracle数据库进程的启动和关闭  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!w

知识大全 C#创建Windows服务

C#创建Windows服务  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  &

知识大全 给WINDOWS服务加上描述

高手进阶:给WINDOWS服务加上描述  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! &

知识大全 Delphi开发Windows服务程序

Delphi开发Windows服务程序  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  开发步骤: