BAM部署视图失败 - OLE DB or ODBC error: Cannot open database "BAMStarSchema". login failed 42000....

本文解决了一个在部署BAM视图时遇到的错误,原因是数据库用户缺少'db_datareader'角色。通过使用T-SQL语句为用户添加此角色,可以解决无法读取数据库数据的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误描述


今天在部署BAM视图时遇到如下错误,找了很久终于找到原因,原来是数据库用户角色设置的问题,BAMStarSchema数据库的用户没有”db_datareader”角色导致无法读取该数据库当中的数据。

英文错误描述信息

Deploying Activity... Done.
Deploying View... ERROR: The BAM deployment failed.
Internal error: The operation terminated unsuccessfully.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Month' attribute
of the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database
was being processed.
Server: The operation has been cancelled.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_Application', Name of 'ExcByApplication_Application'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Application' att
ribute of the 'ExcByApplication_Application' dimension from the 'BAMAnalysis' da
tabase was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcFaultDescription', Name of 'ExcByApplication_ExcFa
ultDescription' was being processed.
Errors in the OLAP storage engine: An error occurred while the 'FaultDescription
' attribute of the 'ExcByApplication_ExcFaultDescription' dimension from the 'BA
MAnalysis' database was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Year' attribute
of the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database
was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Day' attribute o
f the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database w
as being processed.

解决方法


我们可以使用T-SQL语句来修复该数据库中的用户角色设置,为该用户添加对其数据库的“db_datareader”角色。在我的机器上,数据库是运行在DemoDomain/SQL_Service这个账户下的,使用如下脚本启用该用户的'db_datareader'角色,另外你也可以通过SQL Management Studio用鼠标点击配置的方式做同样的操作。

USE BAMStarSchema EXEC sp_addrolemember 'db_datareader', 'DEMODOMAIN/SQL_SERVICE'

<think>好的,用户遇到了一个问题,运行bam_stat.py时出现错误提示“no such option: -r”。首先,我需要确认这个错误的原因。通常这种错误是因为使用了不被支持的选项,也就是这个脚本可能没有-r这个参数。 接下来,我应该检查bam_stat.py的帮助文档,看看支持的参数有哪些。用户可能没有查看帮助,直接使用了-r选项,导致出错。这时候,我需要考虑用户可能的需求,他们为什么会使用-r参数?比如,可能用户想生成报告或者指定参考基因组? 然后,我需要回忆常见的工具,比如RSeQC中的bam_stat.py,是否确实没有-r选项。查阅官方文档或者帮助信息后,确认这个参数是否存在。如果不存在,那么用户可能混淆了不同工具的选项,或者记错了参数名。 用户可能的需求是什么?他们可能想对BAM文件进行统计,并需要参考基因组的信息。比如,有些工具需要参考基因组来生成更详细的统计信息,但bam_stat.py可能不需要。这时候,需要告知用户正确的参数,或者推荐其他工具。 此外,用户可能是在遵循某个教程或流程,其中错误地包含了-r选项。这时候需要指出问题所在,并建议用户检查教程的正确性或联系作者。 最后,给出解决方案,比如使用正确的参数,或者推荐其他类似的工具。同时,提醒用户查看帮助文档,使用-h或--help选项确认支持的参数列表,避免类似错误再次发生。</think>--- ### **问题分析** 出现`bam_stat.py: error: no such option: -r`错误的原因是:**`bam_stat.py`不支持`-r`参数**。该工具可能属于**RSeQC**包(常用RNA-seq质控工具),但其参数列表中没有`-r`选项。 --- ### **解决方案** #### **1. 确认工具来源与参数** - **工具来源**: `bam_stat.py`通常属于**RSeQC**(RNA-seq质量控制系统),用于统计BAM文件的基础信息(如比对率、链特异性等)。 - **查看帮助文档**: ```bash bam_stat.py -h # 查看所有支持的参数 ``` 输出示例: ```plaintext Usage: bam_stat.py [options] -i INPUT_BAM Options: -i, --input-bam=FILE 输入BAM文件(必须) -q, --mapq=INT 过滤低质量比对(默认MAPQ≥30) --output-file=FILE 输出文件名(默认输出到屏幕) ... ``` #### **2. 可能的需求与替代方法** 若尝试通过`-r`实现以下功能,需改用其他方式: | **用户意图** | **正确参数/替代工具** | |--------------------------|----------------------------------| | 指定参考基因组文件 | `bam_stat.py`无需参考基因组 | | 生成报告文件 | 使用`--output-file=FILE`指定输出 | | 区域过滤(如特定基因区) | 先用`samtools view`提取区域 | #### **3. 正确使用示例** ```bash # 基础用法:统计BAM文件比对信息 bam_stat.py -i sample.bam --output-file=stats.txt # 过滤低质量比对(MAPQ≥30) bam_stat.py -i sample.bam -q 30 ``` --- ### **常见混淆工具对比** 若需使用`-r`参数(如指定参考基因组),可能混淆了其他工具: | **工具名称** | **功能** | **关键参数** | |-----------------|--------------------------|---------------------| | `bam_stat.py` | BAM文件基础统计 | `-i`(输入BAM文件) | | `geneBody_coverage.py` | 基因覆盖均匀性分析 | `-r`(参考基因注释)| | `infer_experiment.py` | 链特异性检测 | `-r`(参考基因注释)| --- ### **扩展建议** 1. **检查工具版本**: ```bash bam_stat.py --version # 确认是否版本过低导致参数缺失 ``` 2. **替代工具推荐**: 如需结合参考基因组分析,改用: ```bash # 基因覆盖分析(需-r指定参考基因注释) geneBody_coverage.py -i sample.bam -r genes.bed -o coverage_result ``` --- ### **总结** - **核心错误**:`-r`不是`bam_stat.py`的有效参数。 - **正确操作**: - 通过`bam_stat.py -h`确认支持的参数。 - 若需参考基因组,改用`geneBody_coverage.py`或`infer_experiment.py`等工具。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值