다음을 통해 공유


Analysis Services (SSAS) Error when Executing Query - User does not Have Access or Database does not Exist

Applies to:  SQL Server Analysis Services, multidimensional or tabular

Square brackets around the catalog name in an XMLA query will cause the following error to occur:

Executing the query ...
Either the user, domainname\username, does not have access to the [cube-name-placeholder] database, or the database does not exist.

The problem is that an XMLA Discover command does not support square brackets for the cube or catalog name.  For all other parts of the query, brackets can be used. The restriction applies only to the catalog name.

To resolve the error, remove the square brackets from the catalog name.  If the name contains spaces, leave them in. You can see an example of this further on.

The following example illustrates XMLA that generates the error, followed by XMLA that runs successfully.  As you can see, the difference boils down to the square brackets in the catalog name.

Bad Discover (xmla) command:

1. Running the following XMLA against the deployed AdventureWorks Tabular Model 2012 will cause above error.
 
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>MDSCHEMA_MEMBERS</RequestType>
<Restrictions>
<RestrictionList>
<CUBE_NAME>Model</CUBE_NAME>
<MEMBER_UNIQUE_NAME>[Geography].[Country Region Name].&[United States]</MEMBER_UNIQUE_NAME>
<TREE_OP>4</TREE_OP>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
<Catalog>[AdventureWorks Tabular Model SQL 2012]</Catalog>
</PropertyList>
</Properties>
</Discover>

**Good xmla:
**
2. The following XMLA will work (without the brackets in Catalog).

<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>MDSCHEMA_MEMBERS</RequestType>
<Restrictions>
<RestrictionList>
<CUBE_NAME>Model</CUBE_NAME>
<MEMBER_UNIQUE_NAME>[Geography].[Country Region Name].&[United States]</MEMBER_UNIQUE_NAME>
<TREE_OP>4</TREE_OP>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
<Catalog>AdventureWorks Tabular Model SQL 2012</Catalog>
</PropertyList>
</Properties>
</Discover>

Thanks to Yinn Wong, Customer Support engineer, who provided the information for this post.