---
title: "从命令行启动Cognos的方法【转】"
author: "小丑鱼0703"
date: "2012-07-20T09:07:27Z"
tags: ["Cognos", "启动"]
categories: ["行业应用"]
slug: "cognos"
draft: false
lastmod: "2014-01-26T14:33:46Z"
id: 1601590
url: "https://wangjingyi.iteye.com/blog/1601590"
---

启动过程一点日志信息都没有输出直接报0103错误，后来我发现在服务中有个IBM Cognos Content store（大概是这个，具体名字也记不清了）的服务，判断这个问题应该是安装过程中选中了Cognos Content Database，但是在Cognos Configuration中配置的content store却是Oracle导致的。因为如果安装过程中你选中了cognos content database组件，那么你配置的content store必须是 cognos content database，配置其他的都不行。所以把cognos卸载，重新安装，本以为这次应该没有问题了，但是还是报错，想着可能是环境变量的问题，又把环境变量改了改，还是不行，从cognos configuration启动还是报错，不过我感觉一切都没有问题了。  
所以换了种方式，从命令行启动，通过调用cogbootstrapservice来启动cognos。在windows环境中cognos第一次启动会创建一个系统服务。

![](http://dl.iteye.com/upload/attachment/0071/0455/ae91376b-c98a-307d-9bcf-bfc40c2b5f15.png)

      从上图可以看到服务所调用的可执行文件就是cogbootstrapservice.exe，服务类型为自动，所以系统启动后会自动调用此服务，启动cognos。Ps：如果是服务器中启动类型最好是自动，省的有人再去启动它，如果是自己的机器安装仅是为了学习，最好设置为手动，要不然你的系统会在登录时等很长时间。  
到命令行里，切到c8\_localation/bin目录下，执行cogbootstrapservice.exe –help查看该命令的帮助

 

Manage the Cognos Bootstrap Service.

By default the service name is determined from startup configuration,  
but may be overriden by -name.

Note that on Win32 CBS operates invisibly, with no console window  
unless -console is specified. -help, -d and -v are exceptions: they  
always open a console.

The option -stdoutLog=DEBUG|INFO|WARN|ERROR|FATAL is optional for all  
flavours of the command line. It causes log messages that describe the  
actvities of CBS to be written to stdout.

Usage:

cogbootstrapservice -i\[a|m] \[-name=serviceName] \[-console]  
Install as service. Service is automatically started (-i or -ia) or manually (-im).

cogbootstrapservice -u \[-name=serviceName] \[-console]  
Uninstall the service.

cogbootstrapservice -isRegistered \[-name=serviceName] \[-console]  
Test if the service is installed.  
Exit code is 0 if the service is not installed, otherwise is the numeric value of the "Start" parameter:2 - auto, 3 - manual, 4 - disabled.

cogbootstrapservice -start \[-name=serviceName] \[-timeLimitSec=nn] \[-console]  
Start the service. Note that the operation blocks until the service is started or the specified time limit is reached.

cogbootstrapservice -stop \[-name=serviceName] \[-timeLimitSec=nn] \[-console]  
Stop the service. Note that the operation blocks until the service is stopped or the specified time limit is reached.

cogbootstrapservice -isrunning \[-name=serviceName] \[-console]  
Test is the service is running. Exit code of 0 indicates that the service is running.

cogbootstrapservice -d  
Run the service as a console application.

      其实最常用的也就是-d –start –stop这几个参数，-I –u –isRegistered这几个一般都是Cognos Configuration调用用来创建或删除服务用的。

-d参数表示要启动一个控制台窗口  
\-start表示启动服务，帮助说这个操作是个阻塞型操作，知道服务启动才会往下执行，但是我在windows下调用时并有发现他是阻塞的。  
\-stop关闭服务器，同样的，我也没有发现它是阻塞的

 如果想启动服务执行 cogbootstraoservice.exe –start

 如果想让它弹出个窗口 cogbootstrapservice.exe –d –start(如果在telnet调用的话服务器中不弹出窗口)

 想关闭服务 执行 cogbootstrapservice.ext –stop

      说到这里还有一种方式也是在可以在命令行里启动cognos服务，比cogbootstrapservice更简单，它就是c8/bin目录下的startup.bat和shutdown.bat。Cogbootstrapservice和startup.bat的区别在于，cogbootstrapservice会启动tomcat的同时还启动一个守护进程，当tomcat被意外终止，它还会再次调用，而startup.bat则没有守护进程。

 

 

 

原文地址：

[http://www.cognoschina.net/home/space.php?uid=6810&do=blog&id=2905](http://www.cognoschina.net/home/space.php?uid=6810&do=blog&id=2905)